Thursday, 24 September 2026
PastThree rungs, one idea. Solving rung 1 counts. Climb as far as you can.
Counting Down
while loops + counting down
All the way to one
Write a function called countdown
Return a list counting down from start to 1, so 5 gives [5, 4, 3, 2, 1]. If start is 0 or a negative number there is nothing to count, so return an empty list.
Examples
| Input | Output |
|---|---|
| 5 | [5, 4, 3, 2, 1] |
| 1 | [1] |
| 0 | [] |
| -3 | [] |
There are extra hidden tests, so make it work in general, not just for these.
Bigger jumps
Write a function called countdown_by
Now take away step each time instead of 1, and keep every number that is still above 0. So 10 with a step of 3 gives [10, 7, 4, 1]. step is always 1 or more. If start is 0 or less, return an empty list.
Examples
| Input | Output |
|---|---|
| 10, 3 | [10, 7, 4, 1] |
| 10, 4 | [10, 6, 2] |
| 5, 1 | [5, 4, 3, 2, 1] |
| 0, 2 | [] |
There are extra hidden tests, so make it work in general, not just for these.
Leave some out
Write a function called countdown_skipping
Count down from start to 1 one number at a time, but leave out every number that divides exactly by skip. With a skip of 3 you would drop 9, 6 and 3. skip is always 2 or more. Careful: this is not the same as jumping by skip.
Examples
| Input | Output |
|---|---|
| 10, 3 | [10, 8, 7, 5, 4, 2, 1] |
| 5, 2 | [5, 3, 1] |
| 0, 2 | [] |
| 4, 5 | [4, 3, 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.