Python program to find the sum of elements in a list
In this python programming tutorial, we are going to learn

python program to find the sum of elements in a list
python program to find the sum of elements in a list
The python program to find sum of all items in a list is as follows:
# Owner : TutorialsInhand Author : Devjeet Roy
marks=[78,56,98,39,55,91,72]
sum_of_numbers = 0
for i in marks:
sum_of_numbers += i
print("The sum is: ",sum_of_numbers)
The output of python program to find the sum of elements in a list is as follows:
PS C:\Users\DEVJEET\Desktop\tutorialsInHand> python code.py
The sum is: 489
Few important tips about the program
1. We iterate over each and every elements of the list and keep adding them to find the sum.
2. Python also provides a inbuilt sum() function to do the same.
python program to find the sum of elements in a list snapshot:
This wraps up our session on python program to find sum of all items in a list.
Would you like to see your article here on tutorialsinhand.
Join
Write4Us program by tutorialsinhand.com
About the Author
Devjeet Roy
Full Stack Web Developer & Data Science Enthusiast
Page Views :
Published Date :
Jun 16,2022