Head, Shoulders, Knees and Toes Algorithms

Head, Shoulders, Knees and Toes, Algorithms

  • algorithms-concept-icon
  • debugging-concept-icon
  • repetition-concept-icon


In this lesson pupils create a set of instructions (an algorithm) to sing a well-known song. They also debug their algorithm and learn to use repetition.

Pupil Objectives

  • I can follow instructions.
  • I can create a sequence of instructions for people to follow (an algorithm).
  • I can find and correct errors in a sequence of instructions (I can debug an algorithm)
  • I can use repetition in a sequence of instructions


  • Explain to the pupils that they are going to be creating the instructions for other people to follow to sing a song. If appropriate explain to the pupils that this is called an algorithm (a sequence of instructions to get something done).
  • Sing the song Head, Shoulders, Knees and Toes as a class, with actions.
  • As you do so, hold up one card at a time with an image of a body part on, and ask the pupils to touch the correct part of their body.

Main Activity

Creating and testing instructions:

  • Stick a sequence of 7 cards on the board in a random order (e.g. shoulders, eyes, head, toes, ears, knees). Explain to the pupils that these are instructions (an algorithm) to sing the song, and people can follow them.
  • Sing the first line of the song again as a class, this time following the order on the board.
  • Ask the pupils if the sequence is correct. Can they explain what is wrong with the instructions (algorithm)? For example: the order is wrong; some body parts are repeated but only appear once on the board.

Correcting the instructions:

  • Explain that the pupils need to help you to correct the instructions. If appropriate explain that this is called debugging.
  • Ask the class which body parts don’t belong in the first line, and remove them. Which body parts are repeated in the song – provide the repeated cards for knees and toes. Are any of the cards in the correct place? Ask the pupils to correct the sequence by
    swapping the cards as necessary and adding the repeated body parts.
  • In larger classes, pupils could work in small groups with their own set of cards.
  • Once the class have corrected the first line, ask them to test it. Does it work? If appropriate, remind them that they have debugged the sequence.
  • Discuss with the class which cards they need to add for the second line of the song (i.e. the repeat of the first line). What instruction could they use instead? Provide a x2 card for them to add to the board. Explain, if appropriate, that this is an example of
    repetition and this helps to make instructions shorter and easier to understand.
  • Add the last four body part cards on the next line and ask the class to debug this line as they did above. What instruction will they use for the final line? Provide a Repeat 1st line card to complete the song.


  • Sing the song once again as a class, following the completed algorithm. Is it correct?
  • Revisit or introduce the term algorithm, as appropriate, and what it means – a sequence of instructions to get something done. Discuss with the class how they debugged the algorithm: by spotting a mistake and correcting it by removing it or swapping its position.


  • Support: Provide a sequence on the board for the first line that is almost correct (e.g. Heads, Knees, Shoulders, Toes, Shoulders, Toes) and ask pupils to only swap the cards that are in the wrong place. Provide a grid with the correct sequence on to match the cards to if necessary.
  • Stretch & challenge: Provide a blank card for pupils to write their own repeat x 2 version of a command on. Provide algorithms to sing other familiar songs that contain errors. Can pupils debug the algorithms?

Extension Ideas

  • Pupils can create an algorithm for an everyday task, such as brushing teeth or getting dressed using a sequence of cards or by taking their own photos and ordering.                             

Teaching Notes:

Concepts and approaches

  • The pupils create an algorithm for singing the song by placing the cards in the correct order.
  • Pupils debug their algorithm by spotting and correcting errors in the sequence.
  • Pupils use repetition to create a shorter algorithm.

Curriculum Links

  • Computing: Understand what an algorithm is. Using repetition. Debugging algorithms.
  • PSHE: Working with others.
  • Music:Listening to and singing songs


  • Body part cards
  • Repeat cards

This resource was designed in conjunction with Kim Calvert and Tom Radge, CAS Master Teachers of Computing working in special educational needs schools.