Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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

n=int(input("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))
Source by www.sanfoundry.com #
 
PREVIOUS NEXT
Tagged: #Python #Program #Calculate #Average #Numbers #Given #List
ADD COMMENT
Topic
Name
9+9 =