function that accepts any amount of arguments?

Nick Craig-Wood nick at craig-wood.com
Fri Apr 25 08:30:03 EDT 2008


Steve Holden <steve at holdenweb.com> wrote:
>  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 ;-)

Posting to comp.lang.python is pair programming with the entire
internet ;-)


-- 
Nick Craig-Wood <nick at craig-wood.com> -- http://www.craig-wood.com/nick



More information about the Python-list mailing list