- The gold_room has a weird way of getting you to type a number. What are all the bugs in this way of doing it? Can you make it better than what I’ve written? Look at how int() works for clues
def gold_room():
print("This room is full of gold. How much do you take?")
choice = input("> ")
if choice.isdigit():
how_much = int(choice)
else:
dead("Man, learn to type a number.")
if how_much < 50:
print("Nice, you're not greedy, you win!")
exit(0)
else:
dead("You greedy bastard!")
The solution was using try and except but I used the isdigit() method instead I don’t know if that’s a bad thing or not.