samedi 24 octobre 2020

Can you reject a variable with another variable in python? [duplicate]

Is there a way to reject a variable with another variable. For example:( this is how i start my code)

typeofplane = input(" what is the type of plane?" )
if typeofplane is not a or b or c: #I know this line of code won't work. 
print= ("invalid")
# after the invalid, it will go back to ask the user to enter the type of the plane

So what I mean is that if the typeofplane is other than ' a' , ' b ' , ' c ' , stop the loop and return to the beginning of the code.

Aucun commentaire:

Enregistrer un commentaire