Grade Classifier - Problem
You are building a grading system for a school. Given a student's numerical score (0-100), you need to assign the corresponding letter grade based on the standard grading scale.
Grading Scale:
A: 90-100B: 80-89C: 70-79D: 60-69F: 0-59
Your task is to write a function that takes a numerical score and returns the appropriate letter grade as a string.
Input & Output
Example 1 — Excellent Grade
$
Input:
score = 92
›
Output:
A
💡 Note:
Score 92 is >= 90, so it falls in the A grade range (90-100)
Example 2 — Good Grade
$
Input:
score = 85
›
Output:
B
💡 Note:
Score 85 is >= 80 but < 90, so it gets grade B (80-89)
Example 3 — Failing Grade
$
Input:
score = 45
›
Output:
F
💡 Note:
Score 45 is < 60, so it receives the failing grade F
Constraints
- 0 ≤ score ≤ 100
- Score is always an integer
Visualization
Tap to expand
💡
Explanation
AI Ready
💡 Suggestion
Tab
to accept
Esc
to dismiss
// Output will appear here after running code