Just trying my first piece of code doing the exercise 36 in LPTHW. I'm supposed to create a basic game but I run into a problem with the first conditional. Whether I input red, green, blue or any other thing I get the function that is supposed to run only when red is entered:
player = input("Welcome to The Hall! What's your name? > ")
def hall():
hallDoor = input(f"""Welcome to The Hall {player}! There are 3 doors in front of you, which one will you choose?
- Red door
- Green door
- Blue door
> """)
if "red" or "Red" in hallDoor:
monster1()
elif "green" or "Green" in hallDoor:
monster2()
elif "blue" or "Blue" in hallDoor:
god()
else:
print("Pick a color")
hall()
def monster1():
print("Meet Neil!")
exit(0)
def monster2():
print("Meet Brad!")
exit(0)
def god():
hall()
hall()
I've been trying to figure it out for a while but can't. I'm using Reapl.it.
Aucun commentaire:
Enregistrer un commentaire