PLIRO / Teaching material
A first programming lesson for ages 8–10
Four moves and four turns make a square. Ask learners to predict, run the code and change one number. You can start this lesson without being a programming expert.
Start the working example01
What you will practise
- Read a sequence of instructions in order.
- Identify the two instructions repeated four times.
- Predict and explain what changing one number does.
02
What you need
- A computer, Chromebook or tablet per learner or pair, with internet and an up-to-date browser.
- Paper and a pencil for drawing the route first.
- A shared screen is useful for the whole-class introduction.
Preparation
- Open the example below on a learner’s device and run it.
- Try changing distance = 60 to distance = 90 yourself.
- Agree who types and who predicts, then swap roles later.
Teaching material
Step by step
Predict the route · 5 minutes
Read the four moves and the 90-degree turn. Ask learners to draw where they expect the turtle to finish.
Open and run · 5 minutes
Open the project below and press Run. Compare the drawing with the prediction. ‘Square finished!’ appears in Output.
Read the loop · 10 minutes
Discuss how forward and right run for each number in [1, 2, 3, 4]. The indented lines belong together.
Change one value · 15 minutes
Choose Code, then Text. Change only distance = 60 to distance = 90. Predict what will change, press Run and compare. Then choose a distance between 30 and 100.
Explain a choice · 10 minutes
Ask each pair what they changed, expected and saw. Invite one learner to point to the line that controls the size.
Try it yourself
This starting code works. Open the project, choose Code, then Text, to change something, then press Run.
# language: en
let distance = 60
for side in [1, 2, 3, 4]:
forward distance
right 90
say "Square finished!"
The example result
A closed square. With distance 90, all four sides are longer than with distance 60; the shape is still a square.
Discuss what you discovered
Invite learners to complete ‘I changed … because … and I saw …’. Use their answer to choose the next task.
Extra material for this lesson
A next step
