Python Practice › Dictionary Programs › Program 38
Mean of dictionary values
Write a Python program to find the mean of a dictionary’s values.
Input
{"m1": 25, "m2": 20, "m3": 15}Output
Mean is 20.0
Approach
sum / len.
Solution
d = {"m1": 25, "m2": 20, "m3": 15}print("Mean is", sum(d.values()) / len(d))Output
Mean is 20.0
Learn the concept
New to this topic? Read the lesson, then come back.