Saturday, 31 October 2026
PastThree rungs, one idea. Solving rung 1 counts. Climb as far as you can.
Times Tables
loops + times tables
Build the table
Write a function called times_table
You get a whole number n that is 0 or bigger. Return a list of the first 10 numbers in its times table, from n times 1 up to n times 10. So 2 gives [2, 4, 6, 8, 10, 12, 14, 16, 18, 20].
Examples
| Input | Output |
|---|---|
| 3 | [3, 6, 9, 12, 15, 18, 21, 24, 27, 30] |
| 1 | [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] |
| 0 | [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] |
| 5 | [5, 10, 15, 20, 25, 30, 35, 40, 45, 50] |
There are extra hidden tests, so make it work in general, not just for these.
Add up the table
Write a function called table_total
Now you also get rows, how many numbers of the table to use, and you return their total. The 3 times table with 4 rows is 3 + 6 + 9 + 12, so the answer is 30. A rows of 0 means nothing to add, so return 0.
Examples
| Input | Output |
|---|---|
| 3, 4 | 30 |
| 5, 1 | 5 |
| 2, 0 | 0 |
| 10, 3 | 60 |
There are extra hidden tests, so make it work in general, not just for these.
Which tables is it in
Write a function called tables_with
Look at the times tables from 1 up to 10, where each table goes from times 1 to times 10. Return a list of the tables that contain target, smallest first. The number 12 is in the 2, 3, 4 and 6 tables (2 x 6, 3 x 4, 4 x 3, 6 x 2), so it gives [2, 3, 4, 6]. target is 0 or bigger, and 0 is in none of these tables, so it gives an empty list.
Examples
| Input | Output |
|---|---|
| 12 | [2, 3, 4, 6] |
| 7 | [1, 7] |
| 13 | [] |
| 0 | [] |
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.