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.
while | | | | | endwhile
print("Well done, you guessed correctly.")
guess = input("Guess a number")
if guess !=number then | else | end if
number = random_number()
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 firstname.lastname@example.org or Tweet us @Hello_World_Edu to share your ideas.
An online Parson's puzzle creator
Hands-On Coding Blocks let children physically move and act out algorithms
'Evaluating a New Exam Question: Parsons Problems' by Paul Denny, Andrew Luxton Reilly, and Beth Simon
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.")