Saturday, 26 September 2026
PastThree rungs, one idea. Solving rung 1 counts. Climb as far as you can.
Match Points
functions + working out totals
Add up the season
Write a function called match_points
A win is worth 3 points and a draw is worth 1 point. Given how many wins and how many draws a team had, return its total points. A team with no games returns 0.
Examples
| Input | Output |
|---|---|
| 2, 1 | 7 |
| 0, 0 | 0 |
| 1, 0 | 3 |
| 0, 4 | 4 |
There are extra hidden tests, so make it work in general, not just for these.
Read the results
Write a function called results_points
results is a string made of the letters "W", "D" and "L", one per game. A "W" is worth win_points, a "D" is worth 1 and an "L" is worth nothing. Return the total. An empty string returns 0.
Examples
| Input | Output |
|---|---|
| "WWDL", 3 | 7 |
| "", 3 | 0 |
| "LLL", 3 | 0 |
| "WW", 2 | 4 |
There are extra hidden tests, so make it work in general, not just for these.
How many more wins
Write a function called wins_needed
Work out the points from results the same way, then return how many extra wins the team needs to reach target points or more. win_points is always 1 or more. If the team is already on target or above, return 0.
Examples
| Input | Output |
|---|---|
| "WWDL", 3, 10 | 1 |
| "WWDL", 3, 7 | 0 |
| "", 3, 10 | 4 |
| "LLL", 2, 5 | 3 |
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.