def mean(n):
l=[]
for i in range(n):
num=int(input("Enter the number"))
l.append(num)
#mean logic
sum=0
for j in range(len(l)):
sum=sum+l[j]
avg=sum//n
print("The mean value of list is:",avg)
#main program
n=int(input("Enter the size of the list"))
print("The size of the list",n)
mean(n)
Example:
Enter the size of the list5 The size of the list 5 Enter the number6 Enter the number4 Enter the number5 Enter the number10 Enter the number20
The mean value of list is: 9
No comments:
Post a Comment