[Tutor] Now I have a variable-passing problem!
Sun, 14 Oct 2001 18:24:45 +0100
> you recursively call get_number you aren't storing the value
> like 'result = get_number()' is needed.
Or just use rawNum...
You could also change the logic of the range check to
simplify a little more and by raising a ValueError
keep all the error handling in one place..
rawNum=raw_input("Enter a number between 0 and 10,000: ")
num_int = int(rawNum)
if 0 < num_int < 10000:
else: raise ValueError
print "Sorry please try again."
Since get_number only ever returns a valid number there's
no need to have an intermediate 'result'.