I guess I am not going mad then!

I will skip this exercise and move on.

Thanks

Jon

On 31/01/06, Alan Gauld < [EMAIL PROTECTED]> wrote:
Hi Jon,

> Improve the function ask_number() so that the function can be called with
> a
> step value. Make the default value of step 1.

If its any consolation that doesn't really mean much to me either.
I understand the concept of step value - range() takes one for
example, check the docs.

But how a step value would be used in this kind of user-input scenario
I have no idea!

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))
    return response

The only possibility I can think of is that the step value is used to
narrow the acceptable range each time round the loop. But given
we don't necessarily tell the user what the range is that would be
weird. We'd need to modify question as we go or something.

On the assumption you aren't being marked on this I'd just
make up your own mind what it should do and do it! :-)

...and treat it as a good example of a bad statement of
requirements!

Alan G




--
Best Regards

Jon Moore
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to