jeudi 4 novembre 2021

Logical operator "or" [duplicate]

HEEEEEELP Hi, I'm want to run the code below in a way that if you choose red or blue as your fav color it responses "awesome" and if you choose any other color it responses "choose again" BUT it only responses with "awesome" no matter what color you choose, for example, if you choose yellow, it again says awesome. P.S. I know other ways to make it right, I just don't understand why this is not correct?! since the "yellow" color is not either blue or red, then I expect "choose again" as a response but it again says "awesome"

Thank you in advance.

color = input("What is your fav color? ")

if color == "red" or "blue":
  print("awesome")
else:
  print("choose again")

Aucun commentaire:

Enregistrer un commentaire