forked from DHRI-Curriculum/python
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathhaunted.py
More file actions
66 lines (54 loc) · 2.65 KB
/
haunted.py
File metadata and controls
66 lines (54 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Final Challenge!
# Expand the haunted house. You might add another door, or create more rooms beyond the existing ones. You might also use a "while loop" to keep you longer in certain rooms, and add more options for responding to the prompt for those rooms.
while True:
print("You come upon a dark house with two doors")
print("Do you go through door #1 or door #2?")
door = input("> ")
if door == "1":
print("There's a monster coming up from the ground!")
print("What do you do?")
print("1. Kick him on the head.")
print("2. Run away.")
monster = input("> ")
if monster == "1":
print("Big mistake! He grabs your foot and eats you alive.")
elif monster == "2":
print("You're too slow... he chases you down and eats you alive!")
else:
print(f"Well, {monster} is probably the better option.")
print("Monster runs away.")
elif door == "2":
print("In the first room, you see two more doors, one made of iron and one made of wood")
print("1. Go in the iron door")
print("2. Go in the wooden door")
print("3. Stay right where you are")
choice = input("> ")
if choice == "1":
print("You come across a chest filled with golden treasure.")
print("Good job!")
break
elif choice == "2":
print("You step into a trapdoor and fall...")
print("...forever.")
elif choice == "3":
print("After hanging out for a while, you notice a little mouse drowning in a puddle. What do you do?")
print("1. Pick it up")
print("2. Ignore it and move on to the next room.")
mouse = input("> ")
if mouse == "1":
print("Wow! It turns into a magical fairy princess. She will grant you one wish. What is it?")
wish = input("> ")
print(f"{wish} sounds like a very nice wish.")
print("Your wish has been granted.")
break
elif mouse == "2":
print("Wow! The mouse turns into a terrible monster who grabs your foot at eats you.")
print("Well done.")
else:
print("You should run away now while you have the chance!")
else:
print("You're idling has awoken the angry spirits of the house")
print("Run away!")
else:
print("You wait to long and the monster from room #1 breaks through the door and eats you!")
# this challenge is inspired and adapted from Zed Shaw's "Learn Python the Hard Way," exercise 31: Making Decisions