problem adding list values

Tomasz Lisowski list at notmyisp.pl
Fri Dec 23 02:44:28 EST 2005


Dave Hansen wrote:
> I think what you want is 
> 
>    for cr in credlist:
>       credits += cr
> 
> Which could also be implemented as
> 
>    credits = reduce(lambda x,y: x+y, credlist)

or even:

credits = sum(credlist)

Tomasz Lisowski



More information about the Python-list mailing list