当我偶然发现这个问题时,我正在做一个简单的物理实验室。我的结论声明拒绝打印完成的值,以至于print(“ hello world”)甚至无法正常工作。
我正在google colab文档上运行此文档,这是作业要求的格式。
g = 9.8
velocity = input("Your Initial velocity is (m/s): ", float())
time = (velocity / (-1.0*g) )
d = ((velocity * time) + (0.5*g*(time**2))
print("Your maximum height is: ", d)
File "<ipython-input-18-04687c2e6c83>", line 33
print("Your maximum height is: ", d)
^
SyntaxError: invalid syntax
这就是错误。我期望有一个浮点值。
d =((速度*时间)+(0.5 * g *(时间** 2))
缺少一个)
。
应该是:
d = ((velocity * time) + (0.5*g*(time**2)))