Parsons Puzzle

What are Parsons Puzzles?

From js-parsons:

Parsons programming puzzles are a type of scaffolded program construction tasks where the learner is given a set of code fragments, blocks of a single or multiple lines of code, and the task is to piece together a program from these. Learners not only select and order but also indent code fragments.

They are challenging problems that reduces the cognitive load and time spent for students.

This variant of Parsons programming puzzles is called two-dimensional (2D) Parsons problems. In Python, code indentation has a semantic meaning, as an indented statement falls into the surrounding control structure, which has lower indentation. That is, code blocks are defined by indentation instead of start and end symbols like curly braces.

The use of Parsons puzzles is an evidence-based teaching practice.


  1. Write the title and the code of a program in the following form. Use a #distractor comment at the end of the line to set it as a distractor line.
  2. Click on the Create Puzzle button to generate the puzzle. You will be redirected to the puzzle page.
    That is an example of a puzzle of the function find_max:
    Copy the URL, and use it as is or embed it as IFrame in your course. For example, you can embed a puzzle in a Jupyter Notebook code cell with:
              from IPython.display import IFrame
              IFrame('<puzzle url>', width=1000, height=400)
    You can find here a Jupyter Notebook example (you should download and run it locally).
  3. If you plan to embed the Parson puzzle under an https website (for example, in a JupyterHub server), you should replace the domain of the puzzle URL. Instead of, use
    So the URL of the previous example would be:

Create Parsons Puzzle