Web Analytics

Python sum() Function

Math Function Addition

The sum() function returns a number, the sum of all items in an iterable.

Syntax

sum(iterable, start)

Parameters

Parameter Description
iterable Required. The sequence to sum
start Optional. A value that is added to the return value

Return Value

A number, the total sum.

Example

Using the sum() function:

Output
Click Run to execute your code

Related Functions