Letter grade

Turn marks into a letter grade on this practice scale: 80 to 100 is A+, 70 to 79 is A, 60 to 69 is B, 50 to 59 is C, 40 to 49 is D, and below 40 is F.

What to build

A chain of conditions with six possible results.

Requirements

  • Use the scale given above.
  • Print only the grade.

Input

One whole number from 0 to 100.

Output

The grade.

Constraints

The marks are from 0 to 100.

Example

Input:

73

Output:

A

Why it works

Checking from the highest band downwards means each elif already knows the marks are below the bands above it.

Examples

Example 1 · Input
73
Expected output
A
Example 2 · Input
39
Expected output
F

Prompts inside input() are ignored when checking, so input("n: ") is fine.

Hints

Hint 1

Check the highest grade first, then go down with elif.

Solution

Show one correct solution (try it yourself first)
marks = int(input())
if marks >= 80:
    print("A+")
elif marks >= 70:
    print("A")
elif marks >= 60:
    print("B")
elif marks >= 50:
    print("C")
elif marks >= 40:
    print("D")
else:
    print("F")

Lesson: Decisions with if →