This is from an assignment I got. I've been trying to find answers on google but nothing helps at all. So far I've done this. I'll appreciate any help!
x = int(input("Enter a value: "))
calculation = sqrt(0.08(x**2 - 8)) 12 / x 4
print (calculation)
CodePudding user response:
You are very close. A couple of minor points - to multiply you always need the *
operator - 0.08(...)
doesn't multiply the value in the brackets by 0.08. Also, you forgot the brackets in a couple of places, e.g. around x 4
.
So this should work:
from math import sqrt
x = int(input("Enter a value: "))
calculation = (sqrt(0.08*(x**2 - 8)) 12) / (x 4)
print (calculation)
CodePudding user response:
sqrt is from math library. Import it or you can use **0.5
Method 1
calculation = ((0.08*(x**2 - 8))**0.5 12) / (x 4)
Method 2
Importing math
calculation = (math.sqrt(0.08*(x**2 - 8)) 12) / (x 4)