All challenges

Tuesday, 13 October 2026

Past

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

Keep Applying The Rule

while loops + repeating a rule

Rung 1Daily goal5 points

Double it a few times

Write a function called double_times

Start from start and double it times times, then return the answer. So 3 doubled 2 times is 12. A times of 0 means no doubling at all, so return start unchanged.

Examples

InputOutput
3, 212
1, 38
5, 05
0, 40

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

Rung 2Bonus7 points

How many doublings

Write a function called doubles_to_pass

Now count instead. Keep doubling start until the value is bigger than limit, and return how many doublings that took. start is always 1 or more. If start is already bigger than limit, no doubling is needed, so return 0.

Examples

InputOutput
1, 104
3, 20
1, 11
5, 1005

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

Rung 3Bonus10 points

Down to one

Write a function called steps_to_one

Here is a rule with two halves: if the number is even, halve it; if it is odd, multiply it by 3 and add 1. Keep going until the number reaches 1 and return how many times you applied the rule. n is always 1 or more, and an n of 1 is already finished, so return 0. Starting at 3 the numbers go 10, 5, 16, 8, 4, 2, 1 — that is 7 steps.

Examples

InputOutput
10
21
37
68

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.