Tuesday, 10 November 2026
PastThree rungs, one idea. Solving rung 1 counts. Climb as far as you can.
Number Triangles
loops + building number rows
One row of numbers
Write a function called number_row
Return a string that counts from 1 up to n, written with no spaces. So 4 gives "1234". The number n is between 0 and 9, and 0 gives an empty string.
Examples
| Input | Output |
|---|---|
| 3 | "123" |
| 1 | "1" |
| 0 | "" |
| 5 | "12345" |
There are extra hidden tests, so make it work in general, not just for these.
A triangle of numbers
Write a function called number_triangle
Return a list of strings: the first row is "1", the second is "12", and each row is one number longer, until the last row counts up to n. So 3 gives ["1", "12", "123"]. The number n is between 0 and 9, and 0 gives an empty list.
Examples
| Input | Output |
|---|---|
| 3 | ["1", "12", "123"] |
| 1 | ["1"] |
| 0 | [] |
| 4 | ["1", "12", "123", "1234"] |
There are extra hidden tests, so make it work in general, not just for these.
Counting back down
Write a function called backwards_triangle
Same shape, but every row counts down to 1 instead of up from 1. The first row is "1", the second is "21", the third is "321", and so on. So 3 gives ["1", "21", "321"]. The number n is between 0 and 9, and 0 gives an empty list.
Examples
| Input | Output |
|---|---|
| 3 | ["1", "21", "321"] |
| 1 | ["1"] |
| 0 | [] |
| 4 | ["1", "21", "321", "4321"] |
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.