문제

I am simply trying to figure out the position based with a varying t and a vaying v_0.

What is wrong with this short program here?

#Position from Simple Equation
t = input('Time (in seconds)')
g = 9.81
v_0 = input('initial velocity')

s=-0.5*g*t^2 + v_0*t

print s

Thanks for the help guys.

도움이 되었습니까?

해결책

^ operator in t^2 is a bit-wise XOR operator.

>>> 3 ^ 3
0

If you intended the power operator, use ** instead.

>>> 3 ** 3
27
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top