how to print sum of a list in python code example
Example 1: python sum of list
>>> list = [1, 2, 3]
>>> sum(list)
6
Example 2: how to add list numbers in python
lst = []
num = int(input('How many numbers: '))
for n in range(num):
numbers = int(input('Enter number '))
lst.append(numbers)
print("Sum of elements in given list is :", sum(lst))