I am making a physics 2d motion calculator that asks for a user input and adds that value to a variable in python. The problem I have is that the while loop I'm using has while V == 0: and if the user inputs 0, the program keeps asking for a new value for V. What can I do to make the program use the inputted value if the value is 0 and stop the program from asking again. Here is my code.
while V == 0:
V = float(input("What is the final velocity?"))
if V == 0:
pass
Here is the equation I want to use
v = V - a*t
I would like to use the number 0 if the user inputs 0, but currently it just moves on and I don't want this.
v = 0
V = 0
d = 0
D = 0
t = 0
a = 0
if inp2 == "2": #solve for final velocity here
print("We will solve for final velocity")
while v == 0:
v = float(input("What is the initial velocity?"))
while a == 0:
a = float(input("What is the acceleration?"))
if a == 0:
pass
while t == 0:
t = float(input("What is the total time"))
V = v + a*t
print ("The final velocity is"), V
V == 0, then why is that your while condition?None- and use that as the condition.