I was doing the study drills for this chapter and I've stumbled upon this problem that I can't seem to figure out, maybe I'm missing something.
Here's the code:
# write a small adventure game similar to ex31
print("""You enter a dungeon and you find yoursfelf in front of three doors.
Do you go through door #1, door #2 or door #3?""")
dungeon_door = input(">> ")
if dungeon_door == '1' or '2':
print("You stumble upon a goblin. What do you do?")
print("1 - Try to kill the goblin with your shoe.")
print("2 - Try to talk things out.")
print("3 - Exit through the door you came from.")
goblin = input(">> ")
if goblin == '1':
print("You actually manage to kill the goblin. Dude you're a beast!")
print("You have to choose between two doors, do you pick the left one or the right one?")
final_door = input(">> ").lower()
if final_door == 'left':
print("This door leads to the treasure chamber. Dungeon cleared, congrats!")
elif final_door == 'right':
print("After you open to door an enormous one-eyed monster eats you. This dungeon was too much for you, try again.")
else:
print(f"What does {final_door} even mean? You're kicked out of the dungeon, bye.")
elif goblin == '2':
print("""Can you speak Ghukliak? Don't think so. The goblin doesn't understand you, you're dead.
The dungeon was too much for you, bye.""")
elif goblin == 3:
print("The door is somehow locked. The goblin takes this chance to kill you. The dungeon was too much for you, bye.")
else:
print(f"What does {goblin} even mean? You're kicked out of the dungeon, bye.")
elif dungeon_door == '3':
print("Well, it's your lucky day. This door leads directly to the treasure chamber. Dungeon cleared, congrats!")
else:
print(f"What does {dungeon_door} even mean? You're kicked out of the dungeon, bye.")
So part of the code works fine, the only problem I have is when I ask the user to make the first choice. When I input '3' as the answer or something completely different from the suggested answers, I get the output as if the user has answered with '1' or '2'. I hope I have been clear enough.
I know it's a bit long and boring, sorry and TIA!