Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

sum of the number in a list in python

# Python program to find sum of elements in list
total = 0
 
# creating a list
list1 = [11, 5, 17, 18, 23]
 
# Iterate each element in list
# and add them in variable total
for ele in range(0, len(list1)):
    total = total + list1[ele]
 
# printing total value
print("Sum of all elements in given list: ", total)
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #sum #number #list #python
ADD COMMENT
Topic
Name
1+9 =