Write A Python Program To Calculate sum Of A List.

 Write A Python Program To Calculate the Sum of the Following List.
a = [2,4,56,7]











Code:

a = [2, 4, 56, 7]

print(a[0] + a[1] + a[2] + a[3])
# OR
print(sum(a))

Output: 69

Download Source Code

Comments

Popular posts from this blog

Write A Python Program, Create n Empty Dictionary Allow 4 Friends To, Enter Their Favorite Programming Language As values and User Keys as their Name Assume That The Names Are Unique.

Write Python Program To Store Seven Fruits Name In a List Enter By The User