Write a programExercise 3/4Intermediate30 XP

Average points per class

Task

The program reads the number of records n and then n lines of name class points (the points are whole numbers). Store each record as a dictionary with the keys meno, trieda and body in a list zaznamy.

Then for each class it prints the average points rounded with round to 1 decimal place, with the classes in alphabetical order:

3.A: 41.5
3.B: 38.0

Examples

  • Input

    3
    Ema 3.A 45
    Adam 3.B 38
    Lea 3.A 38

    Expected output

    3.A: 41.5
    3.B: 38.0

After you submit, 4 hidden tests will also check your solution: one record, classes out of order, needs rounding, the list of dictionaries zaznamy.

Python starts the first time you run code.

Ctrl+Enter runs the program. Tab indents. Press Esc, then Tab, to leave the editor.

Input (stdin)

Each line = one call to input().

Output

Hints

Try it yourself first. Each hint reveals a little more - and lowers the reward a little.

Signed out, hints are free - but no XP is awarded either.

Solution

The solution unlocks after the last hint.