lundi 4 janvier 2016

how to use an 'or' statement with the if and else functions? [duplicate]

This question already has an answer here:

while True:
try:
    print( ' orange / apple / pear')
    select = input('Please type in one of the three listed above ')
    if select == 'orange' or 'apple' or 'pear':
        break
    else:
        print(' Please type in one of the three listed above.' )
        continue
except EOFError:
    continue
print("\n,select")

in this code, i am trying to have the user enter on of the three option and then continue to the print below. But when something other than the three listed is entered the code bypasses the else statement and continues to the print. I do not understand why this happens and in need help to fix this please.

Aucun commentaire:

Enregistrer un commentaire