Home » Python program to calculate the mean of a given list of numbers

Python program to calculate the mean of a given list of numbers

Program to calculate the mean of a given numbers

lst=eval(input("Enter list:"))
length=len(lst)
mean=sum=0
for i in range(0,length):
    sum+=lst[i]
mean=sum/length
print("Given list is:",lst)
print("The mean of the given list is:",mean)

Contents

Output

Enter list:[35,65,78,54,89]

Given list is: [35, 65, 78, 54, 89]

The mean of the given list is: 64.2