Calculate the Average of Numbers in a Given List In Python

Share on facebook
Share on twitter
Share on linkedin
Share on twitter
Share on tumblr

In this Basic Python Program,  we will Calculate the Average of Numbers in a Given List.

Average of Numbers= Sum of numbers/total;

Python Program To Calculate the Average of Numbers in a Given List

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

Leave a Comment

Your email address will not be published. Required fields are marked *