vendredi 27 novembre 2015

if/or function doesn't work properly

i am working on a very simple code, just starting with python actually, but this one problem keeps popping up. i have this code, and many in a similar structure:

if input() == "no" or  input() == "i said no" or  input() == "I said no." or  input() == "No.":
        print("Okay! Would you like to teach me more words or quit?")

and when i run it, it works but i have to input the answer 4 times for it to register. same with others - i have to input as many times as i have my input in the if function. i tried adjusting the code like this:

if (input() == "no" or  input() == "i said no" or  input() == "I said no."  or  input() == "No."):
        print("Okay! Would you like to teach me more words or quit?")

but it still didn't work. how can i solve this issue?

Aucun commentaire:

Enregistrer un commentaire