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

Preview

AC 1.2: Sequence, choice and repeat in data work

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 survey sheets before lunch

An analyst must check 30 sheets. For each one: open it, count the blank answers, and if there are too many, put it in the red pile.

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 blanks are many
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. "Open the sheet" must come before "count the blanks".

Try it: a sequence

Code: python
print("1. Open the sheet")
print("2. Count the blank answers")
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
blanks = 15

if blanks > 10:
    print("Red pile")
else:
    print("Green pile")

# Change blanks to 2 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.