Thursday, 17 September 2026
PastThree rungs, one idea. Solving rung 1 counts. Climb as far as you can.
Grade Bands
if/else + score bands
Turn a score into a letter
Write a function called grade
A score is a whole number from 0 to 100. Return "A" for 90 or more, "B" for 75 to 89, "C" for 50 to 74, and "F" for anything below 50.
Examples
| Input | Output |
|---|---|
| 95 | "A" |
| 75 | "B" |
| 50 | "C" |
| 49 | "F" |
There are extra hidden tests, so make it work in general, not just for these.
Bonus marks first
Write a function called grade_with_bonus
The same bands, but first add bonus extra marks to the score. A score can never go above 100, so 98 with a bonus of 5 becomes 100, not 103.
Examples
| Input | Output |
|---|---|
| 88, 5 | "A" |
| 98, 5 | "A" |
| 45, 5 | "C" |
| 45, 4 | "F" |
There are extra hidden tests, so make it work in general, not just for these.
How far off is it
Write a function called marks_needed
Now work backwards. letter is always "A", "B" or "C", and you return how many more marks the score needs to reach that band. A score of 80 needs 10 more marks for an "A". If the score already reaches the band, return 0.
Examples
| Input | Output |
|---|---|
| 80, "A" | 10 |
| 95, "A" | 0 |
| 40, "C" | 10 |
| 75, "B" | 0 |
There are extra hidden tests, so make it work in general, not just for these.
Finish Rung 1 and today counts. Rungs 2 and 3 are there if you want to push further.