Quentin Gallet-Gilles qgallet at gmail.com
Thu Jun 5 16:02:16 CEST 2008


I don't want to spoil the fun, so I'll just say that "range" is the key
here.

Quentin

On Thu, Jun 5, 2008 at 3:43 PM, garywood <woodygar at sky.com> wrote:

>  Hi there. So I have a challenge in the Python book I am using (python
> programming for the absolute beginner) that tells me to improve an ask_number()
> function, so that it can be called with a step value, and I havn't
> been able to find out yet what's meant by a step value, but i'll keep
> looking of course. I'd just be grateful if someone could illimunate
> this for me.
>
>
> def ask_number(question, low, high):
>     """Ask for a number within a range."""
>     response = None
>     while response not in range(low, high):
>         response = int(raw_input(question))
>     return response
>
> Thanks in advance.
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080605/5cb0730b/attachment.html>


More information about the Python-list mailing list