Challenge: Grade Calculator

Lab Python Beginner 10 points

Read a student's marks (0–100) and print their grade:

  • 90 and above: A
  • 75 to 89: B
  • 50 to 74: C
  • 35 to 49: D
  • below 35: F

Input

One whole number from 0 to 100.

Output

One letter: the grade.

Example

Input

95

Output

A
Sample input available Sample output available
Editor
Python

Hints

Check the highest grade first.

Because elif stops at the first match, you only need >= checks.

Solution explanation

Checking from the top grade down means each elif only needs a single >= test.

Show solution
m = int(input())
if m >= 90:
    print("A")
elif m >= 75:
    print("B")
elif m >= 50:
    print("C")
elif m >= 35:
    print("D")
else:
    print("F")
Output
Answer
HOME LEARN COMMUNITY DASHBOARD