Solution Review: Average Values Within Multiple Dictionaries

This lesson will explain how to find average values of a single key with multiple dictionaries.

We'll cover the following

Solution: Use for loop

  • Iterate over students.values() using for loop to get the age of each student, and add it in a variable.
  • When the for loop terminates, divide the sum of ages with total keys in the dictionary using len(student.keys())

The following python code demonstrates the concept.

Get hands-on with 1400+ tech skills courses.