Python SUM

Sum function

The sum() function return the sum of a sequence values or return the sum of a sequence of numbers and a given value.

Examples

Example 1

>>> x = [1, 2, 3, 4]
>>> sum(x)
10
>>> sum(x,1)
11
>>>