Up and Down the Stairs
Rearrange the lines · Advanced · about 10 min
This program climbs a staircase with a recursive function: a function that calls itself for the next step. When the calls finish, the program comes back down the same way. Its lines are mixed up: put them back in an order that prints exactly the output below. Each line keeps its indentation, so you only choose the order.
Example
In the right order, the program prints:
Start Up to step 1 Up to step 2 Up to step 3 Reached the top Back down from step 3 Back down from step 2 Back down from step 1 Finished
Your program
0 of 10 placedAdd the first line from the blocks.
Blocks
10 blocks still to place
The solution opens after your first Check.