Python Grade Calculator
elif chain Practice

Map score to letter grade

School portals convert numeric scores to A–F. A chain of elif checks from highest threshold down so only one letter prints.

Picture this: marks → letter

Start from the highest band. First match is the grade.

marks0–100
→
≥ 90 Aif
→
≥ 75 Belif
→
else C/Flower bands

In easy words: What is this task?

You convert a numeric score into a grade label (A/B/C/D/F) using if-elif-else checks.

Where this is used

Used in schools, performance dashboards, risk bands, and score-based categorization systems.

Real world: report card API

When you view grades online, the server receives score = 92 and returns A. Each band (90+, 80+, …) is one elif branch — tested in order.

Score → letter bands

<60 F
60 D
70 C
80 B
90 A
Score 92 → Letter A
Branch taken: elif score >= 90

Why order matters

  • Check 90 first, then 80, then 70 — highest grade wins.
  • If you reversed order, every student might get F incorrectly.
  • Practice: read score, print single letter A/B/C/D/F.

Example Program

1score = int(input())
2if score >= 90: print("A")
3elif score >= 80: print("B")
4else: print("F")