Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ex35 extra credit

  • Loading branch information...
commit 2be4de4bb5ad95dd9f91a71ea13be6a741cfd4c4 1 parent 9b93dbb
@megantaylor authored
Showing with 7 additions and 6 deletions.
  1. +7 −6 ex35.py
View
13 ex35.py
@@ -2,12 +2,13 @@
def gold_room():
print "This room is full of gold. How much do you take?"
-
- next = raw_input("> ")
- if "0" in next or "1" in next:
- how_much = int(next)
- else:
- dead("Man, learn to type a number.")
+ while True:
+ try:
+ next = raw_input("> ")
+ how_much = int(next)
+ break
+ except ValueError:
+ print "That's not a number... try again!"
if 50 > how_much:
print "You're not greedy, you win!"
Please sign in to comment.
Something went wrong with that request. Please try again.