Skip to content

Commit 1931145

Browse files
committed
extracted prompt string to a variable
1 parent 4aa1cee commit 1931145

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

ex35.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
from sys import exit
22

3+
prompt = "==> "
4+
35
def gold_room():
46
"""Describe gold room and take user input."""
57
print "This room is full of gold. How much do you take?"
68

7-
next = raw_input("> ")
9+
next = raw_input(prompt)
810

911
if "0" in next or "1" in next:
1012
how_much = int(next)
@@ -27,7 +29,7 @@ def bear_room():
2729
bear_moved = False
2830

2931
while True:
30-
next = raw_input("> ")
32+
next = raw_input(prompt)
3133

3234
if next == "take honey":
3335
dead("The bear looks at you and then pimp slaps your face off.")
@@ -47,7 +49,7 @@ def cthulu_room():
4749
print "He, it, whatever stares at you and you go insane."
4850
print "Do you flee for your life or eat your head?"
4951

50-
next = raw_input("> ")
52+
next = raw_input(prompt)
5153

5254
if "flee" in next:
5355
start()
@@ -68,7 +70,7 @@ def start():
6870
print "There is a door to your right and left."
6971
print "Which one do you take?"
7072

71-
next = raw_input("> ")
73+
next = raw_input(prompt)
7274

7375
if next == "left":
7476
bear_room()

0 commit comments

Comments
 (0)