[Tutor] Step Value

Alan Gauld alan.gauld at btinternet.com
Fri Jun 17 10:30:37 CEST 2011


"Vincent Balmori" <vincentbalmori at yahoo.com> wrote

"def spam(n=3):
    """Return n slices of yummy spam."""
    return "spam "*n


> This is my new code for a default step value based on your feedback 
> Steve:
>
> def ask_number(question, low, high, step):
>  """Ask for a number within a range."""
>   response = None
>   if step == None:
>       step = 1

Nope, you are still missing the point.
Look again at how Steven defined his function.
What is different about his definition of n and your definition of 
step?

HTH,

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/




More information about the Tutor mailing list