lundi 7 mai 2018

Python 3, very strange issue with if statements returning wrong value

I'm kind of new to Python and I'm having a weird issue with some if statements here.

The code should take the mainMenuCheck and pass that to the if statements, then evaluate it. Problem is, when I write in "tutorial" (or any variations thereof), it always returns the value for "start".

Here's the code:

print('Would you like to START a new game, enter a save CODE, or read the TUTORIAL? ')
mainMenuCheck = input()

if mainMenuCheck == 'START' or 'Start' or 'start':
    mainGame.day1()
elif mainMenuCheck == 'TUTORIAL' or 'Tutorial' or 'tutorial':
    mainGame.tutorial()
elif mainMenuCheck == 'CODE' or 'Code' or 'code':
    input("Please enter save code: ")

Where it gets me scratching my head though, is that if I remove the second and third conditions for the "start" statement there, it evaluates just fine. What's going on here?

Aucun commentaire:

Enregistrer un commentaire