Letter Grades for the Class

Python for AIMedium+10 XP+10

Letter Grades for the Class

A teacher has a dictionary of student → score and wants a dictionary of student → letter grade.

Write two functions:

  1. letter_for(score) returns the letter for one score:
ScoreLetter
90 or more"A"
75 to 89"B"
50 to 74"C"
below 50"F"
  1. grade_book(scores) returns a new dictionary with the same students, each mapped to their letter. An empty dictionary gives back an empty dictionary.

Examples

scores = {"Ada": 95, "Ben": 60}
returns {'Ada': 'A', 'Ben': 'C'}
score = 75
returns 'B'

Hints

Solve it to unlock the solution

Once your code passes every test, a reference solution shows up here so you can compare it with yours.

solution.py
CtrlEnterto run