New Post
Loading...

How to Calculate the Average of Numbers in a Given List in Python.

 





  • These are Python Program to Calculate the Average and Sum of Numbers in a Given List.
  • These program takes the elements of the list one by one and displays. 
  • The average of the elements of the list and calculate avg. 


Avg.py

m=int(input("Enter the number of elements to be inserted: "))
s=[]
for i in range(0,m):
elem=int(input("Enter element: "))
s.append(elem)
avg=sum(s)//m
print("Average of elements in the : ",round(avg,2))

OUTPUT

Enter the number of elements to be inserted: 3
Enter element: 44
Enter element: 55
Enter element: 66
Average of elements in the : 22

Post a Comment

0 Comments