# Sum of an array of numbers
no_of_terms = int(input("Enter number of elements in array : "))
list1 = []
for val in range(0,no_of_terms,1):
ele = int(input("Enter integer : "))
list1.append(ele)
print("Sum of elements of list ", sum(list1))
no_of_terms = int(input("Enter number of elements in array : "))
list1 = []
for val in range(0,no_of_terms,1):
ele = int(input("Enter integer : "))
list1.append(ele)
print("Sum of elements of list ", sum(list1))
No comments:
Post a Comment
Don't be a silent reader...
Leave your comments...
Anu