🧩 Block coding, Grade 5 · session 1 of 14 · 60 minutes · free

Algorithms and sequences: exact instructions

Computers follow instructions exactly, one after another. An algorithm is a list of exact steps; a sequence is the order you put them in. Get the order wrong and Byte bumps into a wall!

🎯 Practice mode🖨 Print a worksheet

A complete lesson · 60 minutes

Teach it, see it, practise it, all on this page.

Open this page with your learner and work down it, or press Teach this lesson to go through it one step at a time on a big screen. Every section has something to do.

See the teacher's plan
  1. Warm-up4 min
  2. Algorithms7 min
  3. Turning7 min
  4. Debugging7 min
  5. code.org practical: puzzles 1–518 min
  6. Activity 14 min
  7. Activity 24 min
  8. Activity 33 min
  9. Quiz5 min
  10. Set the project1 min

By the end you can

  • Say what an algorithm is, with an everyday example
  • Put move and turn blocks in the right order to reach a goal
  • Find and fix a bug in a short sequence

Before you start

  • None: this is the first coding lesson

Have ready

  • A computer with a mouse
  • code.org open in another tab (no account needed)
  • Squared paper and a pencil

Grade 5 · ages 9 to 11 · beginner

Warm-up · think first

Tell me how to make a jam sandwich, step by step. I will do exactly what you say, nothing more!

Show the answer

If you say "put jam on the bread" without "open the jar", I cannot! Computers are the same: every step must be said, in the right order.

Teacher tip: Act it out with real or pretend bread and follow the steps too literally. Children love catching the missing step.

More warm-ups for every class →

Part 1 of 3 · learn, see, practise

An algorithm is a list of exact steps

An algorithm is a set of step-by-step instructions to do a job, like a recipe.

A computer cannot guess. It does exactly what each step says, so every step must be clear.

In the maze, Byte knows only three steps: move forward, turn left and turn right.

Example 1

Byte faces right. The star is 3 squares ahead. What is the algorithm?

when runmove forwardmove forwardmove forward
  1. Count the squares between Byte and the star: 3.
  2. One move forward for each square.
  3. move forward, move forward, move forward.

Answer: 3 × move forward

Practise it

Start with the warm-up and go as far as you can. The stretch questions are meant to be hard.

Warm-up

Core

Warm-up

Stretch 🔥

Answers (for the teacher)
  1. 3
  2. 5
  3. yes
  4. put toothpaste on the brush

Part 2 of 3 · learn, see, practise

Turning: Byte's left and right

Turn left and turn right only turn Byte on the spot. They do not move it.

Left and right are Byte's left and right, not yours. Pretend you are Byte, facing the same way.

When Byte faces down the screen, its right is your left!

Example 1

Byte faces right. The path goes on and then down. What does Byte do at the corner?

when runmove forwardmove forwardturn right ↻move forwardmove forward
  1. Move forward twice to reach the corner.
  2. Byte faces right; the path goes down, which is Byte's right.
  3. Turn right, then move forward twice.

Answer: move, move, turn right, move, move

Practise it

Start with the warm-up and go as far as you can. The stretch questions are meant to be hard.

Warm-up

Core

Core

Stretch 🔥

Answers (for the teacher)
  1. right
  2. left
  3. left
  4. 6

Part 3 of 3 · learn, see, practise

Debugging: finding the mistake

A bug is a mistake in a program. Debugging means finding it and fixing it.

Run the program in your head, one block at a time, with your finger on Byte.

Stop at the first block where Byte goes the wrong way: that is the bug.

Example 1

This program crashes Byte into a wall. Which block is the bug?

when runmove forwardmove forwardturn left ↺move forwardmove forward
  1. Blocks 1 and 2: Byte moves to the corner. Good.
  2. Block 3: turn left points Byte up, into the wall.
  3. Change block 3 to turn right.

Answer: Block 3 (turn left should be turn right)

Practise it

Start with the warm-up and go as far as you can. The stretch questions are meant to be hard.

Warm-up

Core

Stretch 🔥

Answers (for the teacher)
  1. 3
  2. yes
  3. 2

Watch out

Common mistakes

Mixing up left and right

Stand up and face the same way as Byte; then turn your own body.

Thinking turn also moves

A turn only spins Byte on the spot; add a move forward after it.

Changing everything after a bug

Find the first wrong block and change only that one.

🖥️ Practical · puzzles 1–5

Classic Maze, puzzles 1 to 5

Now try it for real. Open the puzzles in a new tab and share that tab, then come back here for the activities and quiz.

▶ Open the puzzles on code.org ↗

Step by step

  1. Open the link. No account is needed; press the X on any pop-up tip.
  2. Look at the maze first and plan the path with your finger before you drag any blocks.
  3. Drag blocks under "when run" so they snap together, then press Run.
  4. If you bump into a wall, press Reset, find the bug block and fix only that block.
  5. Try to solve each puzzle with the fewest blocks.

Teacher tips

  • Ask: which way is the character facing? Turn your own body the same way.
  • Puzzle 1 needs only move blocks; turns start a few puzzles later.
  • Celebrate a bug found: debugging is what real programmers do all day.

code.org is a free, non-profit coding site. Its puzzles open in your browser; an account is optional and only saves progress.

Class activity 1 of 3

Be the robot

The learner gives you instructions to walk from your chair to the door. You follow them exactly, like a robot.

  1. The learner may only say: step forward, turn left, turn right.
  2. Follow each instruction exactly, even if it walks you into the wall!
  3. When you go wrong, the learner finds the bug and fixes that one instruction.
  4. Swap: now you give the instructions.

🙌 No screen needed: play it together, step by step.

Class activity 2 of 3

Arrow code

Write each program as arrows: ↑ move forward, ↺ turn left, ↻ turn right.

  1. Read each instruction.
  2. Write one arrow for each block.
  3. Count the arrows.

Answers (for the teacher)
  1. 4
  2. opposite way
  3. 5
  4. 4

Class activity 3 of 3

Fix my morning

Each morning routine has one step in the wrong place. Find the step that should come first.

  1. Read the steps.
  2. Think about what must happen first.
  3. Type that step.

Answers (for the teacher)
  1. put on socks
  2. get a bowl
  3. open the door
  4. turn on the tap

After class · project

My paper maze

Draw a maze on squared paper and write the program to solve it.

What to make: A paper maze with a tested program.

Stretch: Make a second maze that needs exactly 2 turns.

How it is marked

Look forDone well when
MazeClear walls, start and star
ProgramReaches the star with no crash

Project template

Copy it onto paper or print the practice sheet.

My maze (draw it on squared paper)
Byte starts facing: ______
My program: ______________________________
Number of blocks: ___
Tested by: ______  Did it work? ___

Homework

Practise at home

Try each on paper, then tap to see the answer and working. Or print the practice sheet.

  1. Write an algorithm with 5 steps for brushing your teeth.

    Toothpaste on the brush, brush the top teeth, brush the bottom teeth, rinse, put the brush away.

  2. Byte faces right and the star is 6 squares ahead. How many move blocks?

    6

  3. Byte faces down the screen. Which way does turn left point it, on your screen?

    Right

  4. Draw a maze that needs move, move, turn left, move.

    Any maze where the path goes 2 squares, then turns to Byte's left for 1 square.

🔥 Challenge round · finished early?

The hardest questions of the lesson, no notes

Cover the notes and try these from memory. They are meant to make you think hard: draw, try small cases, and check your answer.

Stretch 🔥

Stretch 🔥

Stretch 🔥

Answers (for the teacher)
  1. put toothpaste on the brush
  2. 6
  3. 2

🧠 Think-hard question

Solve the corner maze using only turn left blocks for turning. How many turn lefts make one turn right?

Talk it through or use the drawing board. There is more than one way to get there.

Quiz · 8 questions

Final quiz: check what you learned

Pick an answer to see if it is right and why. Your best score is saved on this device.

1What is an algorithm?
Show the answer

A list of exact steps to do a job. Like a recipe: steps in order.

2Byte faces right. The star is 4 squares ahead. How many move forward blocks?
Show the answer

4. One move for each square.

3What does turn left do?
Show the answer

Spins Byte on the spot. Turns never move Byte; a move forward comes next.

4A bug is …
Show the answer

a mistake in a program. Debugging means finding and fixing it.

5At this corner Byte must …
Show the answer

turn right. The path goes down: Byte's right when it faces right.

6Byte faces up the screen and turns right. Now it faces …
Show the answer

right. Facing up, Byte's right is your right too.

7Which block always starts a maze program?
Show the answer

when run. Blocks must snap under when run to work.

8Your program crashes. What should you do first?
Show the answer

Find the first wrong block. Run it in your head block by block.

🖨 Print what we learned

Make a worksheet from this lesson

Pick what to practise, then print it or choose Save as PDF in the print window to download it.

Include
Options

For parents and teachers

The 60-minute lesson plan

Use it as it is, or stretch any part over two sessions. Each row links to the part of the page you need.

TimePartThe teacherThe learner
0–4 minWarm-upAsk the warm-up question; let them act it out.Guess, then explain.
4–11 minAlgorithmsExplain with the comic, reveal the example, then the practice.Practise; try the star question.
11–18 minTurningExplain, trace the example with a finger on the screen, then the practice.Practise.
18–25 minDebuggingExplain and show the example, then the practice.Practise.
25–43 mincode.org practical: puzzles 1–5Share the code.org tab. Let the learner drive; ask them to say each block out loud before Run.Solve the puzzles; say the plan first.
43–47 minActivity 1An unplugged game: get the learner moving.Play the robot.
47–51 minActivity 2Do the first item together.Finish the activity.
51–54 minActivity 3Quick puzzle; set the rest as homework if time is short.Solve and check.
54–59 minQuizRead each question aloud; the learner taps and reads why.Answer and explain.
59–60 minSet the projectShow the template and agree a day to share it.Start the project.

Questions to ask

  • What is the difference between a turn and a move?
  • How do you know which way to turn?
  • How did you find the bug?

If it feels hard

Put a small arrow sticker on the screen showing Byte's direction, and let the learner turn their own body.

If it feels easy

Solve the corner maze using only turn left blocks for turning. How many turn lefts make one turn right?

FAQ

Algorithms and sequences: exact instructions: questions

What is an algorithm for kids?

A list of exact, step-by-step instructions to do a job, like a recipe or directions to a friend's house.

Is code.org free?

Yes. The Classic Maze puzzles are free and work in a browser without an account; an account only saves progress.

Why do kids mix up left and right in the maze?

Because the character's left and right change with the way it faces. Turning their own body to match helps a lot.

Start a conversation

Want a teacher to take this class?

Tell us the learner's age and level. A teacher from our network teaches with these lessons; we confirm timing and price first.

  • Tell us the learner’s age or grade and goals
  • We’ll suggest a suitable class or learning path
  • We’ll confirm format, timing and fees with a parent or guardian

For a child’s class, please have a parent or guardian send the enquiry. Avoid sharing passwords or sensitive personal details.

We’ll use your details only to respond to this request.

Chat on WhatsApp
Esc

Try