Editor

Shopping List Menu

Rearrange the lines · Advanced · about 9 min

This program runs a small menu in a loop: 1 adds an item to a shopping list, 2 shows the list, 3 leaves, and any other choice is unknown. Its lines are mixed up: put them back in an order that prints exactly the output below. Each block keeps its indentation, so you only choose the order.

Example

The program reads these lines, one at each input():

1
milk
1
bread
2
5
3

In the right order, it prints:

Added milk
Added bread
List: milk, bread
Unknown choice
Bye

Your program

0 of 10 placed

Add the first line from the blocks.

Blocks

10 blocks still to place
The solution opens after your first Check.