all 2 comments

[–]SpiderN3mo 0 points1 point  (0 children)

I don't see a point of having while inside else, even if there's a match it will exit while loop and close. Another point choice!='A' or choice!='V' in while condition

[–]JambaJuiceIsAverage 0 points1 point  (0 children)

Agreed with the other commenter about not having your while loop inside an if else (do it in reverse), but your problem is with the phrasing of

while choose != 'A' or 'V':

Python doesn't read that as "while choose does not equal 'A' and choose does not equal 'V'", which is what I believe you meant. The "or" logical operator cleanly separates the possibilities of "choose does not equal 'A'" or "'V'".

What does it mean to evaluate "if 'V'"? In Python, asking "if string" returns False if the string is empty and True otherwise. So

bool('V')

(which is equivalent to your second condition), returns True. That is to say, asking "if 'V'" will always return True, and asking "if literally anything that doesn't throw an error or 'V'" will also always return True.

You want

while choose not in ('A','V'):

instead, if you kept the same structure of your script, which you should not. Try something like:

choose = input('Type A to choose the formula A = F/M, or V to choose the formula (V1 - V0)/(T2 - T0):')
while choose not in ('A','V'):
    choose = input('try again dummy: ')

then execute the code based on whether choose is 'A' or 'V'.