[Tutor] Newbie question re. Functions
jonathan.r.moore at gmail.com
Tue Jan 31 10:42:05 CET 2006
I am still working my way through my 'Python for absolute beginners book'
and have hit a brick wall with one of the end of chapter exercises.
The challenge says:
Improve the function ask_number() so that the function can be called with a
step value. Make the default value of step 1.
The function looks like this:
def ask_number(question, low, high):
"""Ask for a number within the range"""
response = None
while response not in range(low, high):
response = int(raw_input(question))
The author has not eluded to 'step values' in anyway that I can see in the
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor