Python program to calculate the mean or average of elements in a list

Spread the love

In this tutorial you will learn, how to write python program to calculate the mean or average of elements in a list

Step 1 : Create a list with values

Step 2 : Use predifined function sum() to find sum of the list of values len() function to find length of list.

Step 3: Then divide with sum value with length of the string.

Program Code:

l = [15,16,17,17,19,20]

mean = sum(l)/len(l)
print(mean)

Output:

17.333333333333332

 

admin

admin

Leave a Reply

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