This is a Python program which calculates the sum of all the elements in a list. |
PROGRAM :
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))
OUTPUT :
Python - Sum of all items in a list |
Similar Programs :
C program to calculate the sum of elements in a array
Cpp program to calculate the sum of elements in a array
Java program to calculate the sum of elements in a array