mercredi 2 juin 2021

If statement is not working and is not making sense [duplicate]

I am building a rock paper scissors code, and it includes 5 choices, of rock paper scissors lizard and spock. I wanted to include a statement to make sure that if someone does not pick any of these options, it will tell them it's an invalid choice and stop the program. Unfortunately something is wrong with my if statements and not matter what i put for my choices, it tells me invalid choice and exits the code.

choice = str(input("1)Rock \n2)Paper\n3)Scissors\n4)Lizard\n5)Spock\nChoice: ")).lower().strip()

if choice != "rock" or  "paper" or "scissors" or  "lizard" or  "spock":
  print("This is an Invalid choice")
  raise SystemExit

Aucun commentaire:

Enregistrer un commentaire