Editor

Primes With a Helper Function

Rearrange the lines · Intermediate · about 8 min

This program writes a function that decides whether a number is prime, then uses it to collect every prime below 30 in a list. 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

In the right order, the program prints:

[2, 3, 5, 7, 11, 13, 17, 19, 23, 29]

Your program

0 of 9 placed

Add the first line from the blocks.

Blocks

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