150k views
0 votes
Project stem 12.3 question 2 please help

Instructions

Write a method find_mean that finds the mean (average) of all the values in a dictionary parameter and returns it. You may assume that all values stored in the dictionary are numbers.
For, example the following call:
d = {"first": 1.5, "second": 8.5, "third": 6.5}
find_mean(d)
should return the number 5.5.



User Mborsuk
by
8.8k points

1 Answer

5 votes

def find_mean(dict):

return sum(dict.values()) / len(dict)

User Huralnyk
by
8.9k points