Python sum() Function
As the name says, python sum() function is used to get the sum of numbers of an iterable, i.e. list.
iterable - iterable can be list, tuples, and dictionaries, but an iterable object must contain numbers.
start - The start is added to the sum of numbers in the iterable. If start is not given in the syntax, it is assumed to be 0.
Let's see some examples of sum() function are given below:
Python sum() Function Example 1
This example shows sum of the list of numbers:
Python sum() Function Example 2
This example shows sum of floating point numbers:
Python sum() Function Example 3
This example shows sum of complex numbers:
(4+6j) (6+8j) (4.5+0j)