Calculate the Average of Numbers in a Given List In Python

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 Reply

Shopping cart