function that accepts any amount of arguments?

Steve Holden steve at holdenweb.com
Thu Apr 24 07:20:57 EDT 2008


Ken wrote:
> "Steve Holden" <steve at holdenweb.com> wrote in message 
[...]
>> def mean(*x):
>>     total = 0.0
>>     for v in x:
>>         total += v
>>     return v/len(x)
>>
> 
>  think you want total/len(x) in return statement
> 
Yes indeed, how glad I am I wrote "untested". I clearly wasn't pair 
programming when I wrote this post ;-)

regards
  Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list