这是我接到的任务。我一直在谷歌上寻找答案,但没有任何帮助。到目前为止我已经这么做了。我会感谢你的帮助!
x = int(input("Enter a value: "))
calculation = sqrt(0.08(x**2 - 8)) + 12 / x + 4
print (calculation)发布于 2022-03-05 04:45:47
你们很亲密。有几个小点--要乘法,总是需要*操作符-- 0.08(...)不会将括号中的值乘以0.08。另外,您还把括号忘在了几个地方,例如x + 4周围。
所以这应该是可行的:
from math import sqrt
x = int(input("Enter a value: "))
calculation = (sqrt(0.08*(x**2 - 8)) + 12) / (x + 4)
print (calculation)发布于 2022-03-05 05:04:38
sqrt是数学图书馆的。导入它,或者您可以使用**0.5
方法1
calculation = ((0.08*(x**2 - 8))**0.5 + 12) / (x + 4)方法2
导入数学
calculation = (math.sqrt(0.08*(x**2 - 8)) + 12) / (x + 4)https://stackoverflow.com/questions/71359542
复制相似问题