Tuesday, 24 November 2026
PastThree rungs, one idea. Solving rung 1 counts. Climb as far as you can.
Counting Pence
functions + whole pence
What it costs
Write a function called cost_of
One sweet costs price pence. Return how many pence count sweets cost. 4 sweets at 25 pence each cost 100 pence, and buying none costs 0.
Examples
| Input | Output |
|---|---|
| 25, 4 | 100 |
| 60, 0 | 0 |
| 99, 1 | 99 |
| 5, 3 | 15 |
There are extra hidden tests, so make it work in general, not just for these.
Change from a note
Write a function called change_for
You hand over paid pence for count sweets that cost price pence each. Return your change in pence. Paying exactly the right amount gives 0, and if you did not pay enough, return None.
Examples
| Input | Output |
|---|---|
| 500, 120, 3 | 140 |
| 200, 50, 4 | 0 |
| 100, 60, 2 | None |
| 1000, 0, 5 | 1000 |
There are extra hidden tests, so make it work in general, not just for these.
Splitting the bill
Write a function called split_bill
A bill of total pence is shared between people people, and everyone pays whole pence. Return a list of what each person pays. Shares are as equal as possible, and any left-over pence are paid one each by the first people in the list. 100 pence between 3 people gives [34, 33, 33]. people is always 1 or more.
Examples
| Input | Output |
|---|---|
| 100, 3 | [34, 33, 33] |
| 90, 3 | [30, 30, 30] |
| 5, 1 | [5] |
| 7, 4 | [2, 2, 2, 1] |
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.