In the mentioned exercise there's this code:
from sys import exit
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.")
if how_much < 50:
print "Nice, you're not greedy, you win!"
exit (0)
else:
dead ("You greedy bastard!")
In the 7th line, I want to put the regular expression [0-9] instead of 0 or 1, so that any inserted number would be passed to the next if statement, so I replaced it with:
if next == [0-9]:
but after inserting any number I get the error message:
Man, learn to type a number.
I don't understand what's wrong.
Thank you for help