Score to grade

Easyif elifinput checks· 10 XP

A course platform turns test scores (0 to 100) into letter grades: A for 90 and up, B for 80 to 89, C for 70 to 79, D for 60 to 69 and F below 60.

Write a function grade(score) that returns the letter as a string. If the score is below 0 or above 100, return "invalid" instead.

How it's checked

Your code runs, then the check below runs and its printed output is compared with ours.

  • grade(85) returns "B", and grade(101) returns "invalid"

Hints, the later steps and the answer come with Pro.

def grade(score):
    ...