# Average of numbers in a list
Nterms = int(input("Enter number of terms in List:"))
L = []
print("Enter", Nterms, "numbers : ")
for idx in range(0,Nterms, 1):
ele = int(input())
L.append(ele)
sumofele = sum(L)
avg = sumofele / len(L)
print("Elements in List =", L)
print("Sum of elements in List =", sumofele)
print("Average of elements in List =", round(avg,2))
Nterms = int(input("Enter number of terms in List:"))
L = []
print("Enter", Nterms, "numbers : ")
for idx in range(0,Nterms, 1):
ele = int(input())
L.append(ele)
sumofele = sum(L)
avg = sumofele / len(L)
print("Elements in List =", L)
print("Sum of elements in List =", sumofele)
print("Average of elements in List =", round(avg,2))
No comments:
Post a Comment
Don't be a silent reader...
Leave your comments...
Anu