Functions help

Mark Lawrence breamoreboy at yahoo.co.uk
Mon Feb 24 02:09:16 CET 2014


On 24/02/2014 00:55, alex23 wrote:
> On 23/02/2014 3:43 PM, Scott W Dunning wrote:
>> I had a question regarding functions.  Is there a way to call a
>> function multiple times without recalling it over and over.  Meaning
>> is there a way I can call a function and then add *5 or something like
>> that?
>
> The same way you repeat anything in Python: with a loop construct.
>
>      for _ in range(5):
>      func()

For the benefit of newbies, besides the obvious indentation error above, 
the underscore basically acts as a dummy variable.  I'll let the 
language lawyers give a very detailed, precise description :)

-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com





More information about the Python-list mailing list