49_Find_mean_average_of_dictionary_values.py


Sign up Free. Don't forget to check out our challenges, lessons, solve and learn series and more ...


Code Snippet

#A little program that finds the mean or the average of the values in a dictionary

mydict = {'E': 18.0, 'D': 17.0, 'C': 19.0, 'B': 15.0, 'A': 0}
mean = float(sum(mydict.values())) / len(mydict)
print (mean)
                    

Try it yourself