Python 3.12.2 (tags/v3.12.2:6abddd9, Feb 6 2024, 21:26:36) [MSC v.
1937 64 bit
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> def start():
... print("You wake up in a dark room. There's a door to your left and a window
to your right.")
... choice = input("Do you go through the door or the window? (door/window):
").lower()
...
... if choice == "door":
... hallway()
... elif choice == "window":
... garden()
... else:
... print("Invalid choice. Try again.")
... start()
...
>>> def hallway():
... print("You are now in a long hallway. You see a staircase leading up and a
door at the end of the hallway.")
... choice = input("Do you take the stairs or go to the door? (stairs/door):
").lower()
...
... if choice == "stairs":
... attic()
... elif choice == "door":
... kitchen()
... else:
... print("Invalid choice. Try again.")
... hallway()
...
>>> def garden():
... print("You are in a beautiful garden. There is a path leading deeper into
the garden and a gate that leads out.")
... choice = input("Do you follow the path or go through the gate? (path/gate):
").lower()
...
... if choice == "path":
... pond()
... elif choice == "gate":
... street()
... else:
... print("Invalid choice. Try again.")
... garden()
...
>>> def attic():
... print("You have reached the attic. It's dusty and full of old furniture.
You see a chest and a window.")
... choice = input("Do you open the chest or look out the window?
(chest/window): ").lower()
...
... if choice == "chest":
... print("You found a treasure! You win!")
... elif choice == "window":
... print("You see the beautiful garden below. You decide to climb down and
explore. You win!")
... else:
... print("Invalid choice. Try again.")
... attic()
...
>>> def kitchen():
... print("You are in the kitchen. There is a fridge and a door leading to the
basement.")
... choice = input("Do you open the fridge or go to the basement?
(fridge/basement): ").lower()
...
... if choice == "fridge":
... print("You found some food and had a nice meal. You win!")
... elif choice == "basement":
... print("You found an old wine cellar. You decide to have a drink and
relax. You win!")
... else:
... print("Invalid choice. Try again.")
... kitchen()
...
>>> def pond():
... print("You found a peaceful pond. You sit by the water and enjoy the
tranquility. You win!")
...
>>> def street():
... print("You are now on the street. You decide to go home. You win!")
...
>>> # Start the game
>>> start()
You wake up in a dark room. There's a door to your left and a window to your right.
Do you go through the door or the window? (door/window): door
You are now in a long hallway. You see a staircase leading up and a door at the end
of the hallway.
Do you take the stairs or go to the door? (stairs/door): door
You are in the kitchen. There is a fridge and a door leading to the basement.
Do you open the fridge or go to the basement? (fridge/basement): fridge
You found some food and had a nice meal. You win!
>>> start
<function start at 0x00000182E116A2A0>
>>> start the game
File "<stdin>", line 1
start the game
^^^
SyntaxError: invalid syntax
>>> start()
You wake up in a dark room. There's a door to your left and a window to your right.
Do you go through the door or the window? (door/window): door
You are now in a long hallway. You see a staircase leading up and a door at the end
of the hallway.
Do you take the stairs or go to the door? (stairs/door): door
You are in the kitchen. There is a fridge and a door leading to the basement.
Do you open the fridge or go to the basement? (fridge/basement): basement
You found an old wine cellar. You decide to have a drink and relax. You win!
>>>