Program to sum all the items in a list.

Code:

total = 0

list1 = [11, 5, 17, 18, 23]

for ele in range(0, len(list1)):

            total = total + list1[ele]

print("Sum of all elements in given list: ", total)

 

Output:

Comments

Popular posts from this blog

State use of pep and pip