Calculate the Average of Numbers in a Given List In Python

Share on facebook
Share on twitter
Share on pinterest

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))

Subscribe to our Newsletter

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

Share this post with your friends

Share on facebook
Share on google
Share on twitter
Share on linkedin

Leave a Reply

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