Question

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.

Was it helpful?

Solution

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

>>> 3 ^ 3
0

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

>>> 3 ** 3
27
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top