# How to calculate sum of a list in Python?

The following Python code demonstrates the working of sum() function which is used to sum all elements in a list.

numbers = [10,22,30,40,50] # Call sum function by passing list Sum = sum(numbers) print(Sum) #152 # We can also specify a numnber as second param to sum function which will be added to the list's sum. Sum = sum(numbers, 10) print(Sum) #162