All challenges

Saturday, 26 September 2026

Past

Three rungs, one idea. Solving rung 1 counts. Climb as far as you can.

Match Points

functions + working out totals

Rung 1Daily goal5 points

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

InputOutput
2, 17
0, 00
1, 03
0, 44

There are extra hidden tests, so make it work in general, not just for these.

Rung 2Bonus7 points

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

InputOutput
"WWDL", 37
"", 30
"LLL", 30
"WW", 24

There are extra hidden tests, so make it work in general, not just for these.

Rung 3Bonus10 points

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

InputOutput
"WWDL", 3, 101
"WWDL", 3, 70
"", 3, 104
"LLL", 2, 53

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.