Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Preview

SC 1.2: Sequence, choice and repeat

This is the first page of the lesson. Read it and have a go at the activities. The rest is in the full lesson.

50 minutes

Checking 30 laptops before lunch

A technician must test 30 laptops. For each one: switch it on, check the battery, and if it fails, put it on the red shelf.

The job has an order, a choice and a repeat. Every algorithm (a set of clear steps) is built from just these three actions.

Key words

WordWhat it meansExample
SequenceSteps done one after another in order
SelectionA choice: do a step only if a condition is trueif battery is low
IterationDoing steps again and again
ConditionA test that is true or false
LoopPython code that repeats steps
FlowchartA picture of steps and choices joined by arrows

The cells students fill in are left blank in this preview.

By the end of this lesson

Note

I can design an algorithm that uses sequence, selection and iteration.

Starter

Have a go

Starter

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Your answers are marked here and are not kept. A college account keeps every student’s marks.

Sequence: one step after another

Sequence means the steps run in the order you write them. The computer does step 1, then step 2, then step 3.

Order matters. "Switch on" must come before "check battery".

Try it: a sequence

Code: python
print("1. Switch on the laptop")
print("2. Check the battery")
print("3. Record the result")

# Swap lines 2 and 3 and press Run. The order changes.

Selection: a choice

Selection means the algorithm chooses what to do. It asks a question. If the answer is yes it does one thing. If no, it does another.

In a flowchart, selection is a decision shape. In Python it is if and else.

Try it: a choice

Code: python
battery = 15

if battery < 20:
    print("Red shelf")
else:
    print("Green shelf")

# Change battery to 80 and press Run.

Check

Have a go

Check

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Your answers are marked here and are not kept. A college account keeps every student’s marks.

The lesson goes on

8 more parts of this lesson are in the full curriculum, with the tasks, the final check and the labs. A college account gives your students all of it.