In the 2nd lesson, students learnt more about Python, including how to implement loops and use variables.

Learning objectives


Lesson Summary

Sabotage! : 10 minutes

Explain they're going to play a game called Sabotage. This game was invented by Alan O'Donohoe to teach resilience in dealing with syntax errors.

Each pair loads their most recent program and saves it to a new file called '' using file->save as. They then make 5 deliberate syntax errors. Students will already have come across syntax errors as they are easily caused by:

After making 5 errors, one person from each team swaps to a different team. The person arriving has to try and fix the syntax errors, and it they get stuck the person who made them can give them clues.

This game is really good fun and worth using a few times until your students are really quick at spotting and fixing errors.

Conditionals : 15 minutes

In our programs so far we have only covered sequences and looped sequences. When we want our program to do something different depending on its environment, we need to use conditionals.

Ask the students for examples of computer games they play. Then ask them what conditionals there are in the games. For example:

Ask the students to look at the conditional statement in their handout.

if loops == 3:
elif loops > 10:

A conditional statement always has to start with the if keyword. It can any number of elifs - even 0. And it can have an optional else that only happens if all the other conditions fail.

Each if or elif has a condition that is evaluated to True or False. If the condition is True, the following indented codes are run.

Ask them what colour the turtle will draw with the variable loops set to 5. Ask what loops would need to be to change the colour to red or green?

Work on their Turtle Prize entry : 25 minutes

Extension activity

Ask students to start creating their own colours using pencolor(). Up till now, we've only used colours written in English, like "red", "blue". We can also make our own custom colours by passing an argument for red, green and blue:


The values have to be between 0 and 1. Students can also look at using a variable instead of typing the number in, then the colour can change as the drawing progresses.

Plenary : 10 minutes

Enter the competition!

Ask the students to add their names, class and school and your email to the top of the code using comments (shown in the handout) Then ask them to submit their code to us at


All students:

Most students

Some students