[Tutor] Adding all numbers in a file or list

Sander Sweers sander.sweers at gmail.com
Mon Aug 23 17:21:43 CEST 2010


On 23 August 2010 17:13, aug dawg <augdawg09 at gmail.com> wrote:
> Is there a command or module that I can use to add all the items in a list?
> Alternatively, is there one I can use to add all the numbers in a file?

sum() is what you are looking for [1].

Greets
Sander

[1] http://docs.python.org/library/functions.html#sum


More information about the Tutor mailing list