Python sum() function

Facebooktwitterredditpinterestlinkedinmailby feather

Python sum() function

The sum() function in python sums start and the items of an iterable from left to right and returns the total. 

Syntax

Parameter

iterable: This parameter represents the sequence to sum.

start: It is optional parameter that represents a value that is added to the return value

Return

This function returns the sum of all items in an iterable.

Example 1

Output

Example 2

Output

Facebooktwitterredditpinterestlinkedinmailby feather