mylist=[5,10,15,20,25]

total=0

for i in range(0,len(mylist)):

total=total+mylist[i]

print(“sum of all elements in a given list:”,total)

sum of all elements in a given list: 75

mylist=[5,10,15,20,25]

total=0

for i in range(0,len(mylist)):

total=total+mylist[i]

print(“sum of all elements in a given list:”,total)

sum of all elements in a given list: 75

4 Likes