Parson's in practice

By James Robinson. Posted

Parson's puzzles require students to organise jumbled lines of code. James Robinson outlines their benefits and shares some ideas of how to apply them in your lessons

Parson's puzzles can help beginner programmers learn how to code. Learners are presented with a program - either in pseudocode, blocks or text, that has been split into sections and then jumbled up.

Have a got at solving this 'number guessing' puzzle and construct a program which will ask you to guess a random number and give you a hint to let you know if your answer was too high or too low.

print("Too low")

while
|
|
|
|
|
endwhile

print("Well done, you guessed correctly.")

guess = input("Guess a number")

if guess !=number then
|
else
|
end if

number = random_number()

print("Too high")

guess = input("Try again")

To increase the difficulty, you could split up the if, else, endif, while, and endwhile statements. The solution to this puzzle is at the end of this article.

How to use Parson's puzzles

You might want to present a puzzle to the whole group as a starter activity for discussion, perhaps to address a misconception; such as that a variable can store multiple variable assignments but jumble up the statements and ask students to rearrange. This works with blocks too!

For longer programs, you may like to deploy a tangible activity to pairs or small groups of learners. In this scenario you can print a program onto paper, slice it into sections like a card sort activity, and as, learners to put them programs together correctly. After a period of time, learners share their solution with the dier group, addressing any issues that arise.

You can even apply this approach to assessment, by creating a drag-and-drop style activity that learners complete on their own. This gives you, the teacher, a quick formative assessment tool.

There are several online told that can be used to create Parson's puzzles.

What the evidence says

The benefits of Parson's puzzles include:

  • Learners find it easier to reassemble chunks of code, over writing programs from square one

  • The puzzles encourage learners to focus on the concepts in a program rather than the syntax

  • They require learners to read and comprehend code, which scaffolds their learning

  • They are inclusive of different abilities and approaches

Why not try this approach in your lessons and let us know how you get on? Email us at contact@helloworld.cc or Tweet us @Hello_World_Edu to share your ideas.

Useful links

Solution to the Parson's Puzzle

number = random_(number()
guess = input("Guess a number")
while guess != number
    if guess > number then
        print("Too high")
    else
        print("Too low")
    endif
    guess = input("Try again")
endwhile
print("Well done, you guess correctly.")  

Educator

Free

If you’re a UK-based teacher, volunteer, librarian or something in between, we'll send each issue free to your door.

Digital

Free

Just want to read the free PDF? Get each new issue delivered straight to your inbox. No fuss and no spam.

Buy

From £6

If you are UK-based but not involved in education, you can get hard copies by buying back issues or subscribing via our partner service.