Python sum() Function
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
Enjoying these tutorials?