Editor

Test Grade Bands

Write the tests · Beginner · about 8 min

grade(score) turns a test score, a whole number from 0 to 100, into a letter: 90 or more is "A", 80 to 89 is "B", 70 to 79 is "C", 60 to 69 is "D", and below 60 is "F".

Write test_ functions with assert that pass on a correct version and fail on broken ones.

Examples

grade(95)    # "A"
grade(83)    # "B"
grade(42)    # "F"
def test_top_grade():
assert grade(95) == "A"
The solution opens after your first Check.