Dictionaries · 11 / 15 Exercise Medium

Average per student

Objective

Create a Python program that calculates the average grade of each student when the same student can have several grades.

Instructions

  • Read an integer n and then n lines with the format name grade (the grade is an integer).
  • Store in a dictionary, for each name, the list of their grades.
  • Show one line per student, sorted alphabetically, with the format name: average and the average with two decimals.
Input
5
ana 8
luis 6
ana 10
eva 7
luis 7
Output
ana: 9.00
eva: 7.00
luis: 6.50

Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.

Start exercise