Sequence, selection and iteration

If you used Scratch or Python at KS3, you have already used the three building blocks of every program. At GCSE you write and read them in Python.

Practise this lesson free (7 questions)

More tools

Sequence

Sequence means instructions run one after another, in order.
Change the order and you can change the result.
price = 4
qty = 3
total = price * qty
print(total)
Output: 12

Selection

Selection means a decision chooses which instructions run. In Python this is if and else.
The lines that belong to the if are indented.
temp = 24
if temp > 20:
    print("Shorts")
else:
    print("Jeans")
Output: Shorts

Iteration

Iteration means repeating instructions using a loop.
A for loop repeats a set number of times. A while loop repeats while a condition is True.
for i in range(3):
    print("Hip hip hooray")
The message is printed 3 times. range(3) gives 0, 1, 2.
Worked example

What does this program print?
total = 0
for n in range(1, 6):
    total = total + n
print(total)

  1. range(1, 6) gives 1, 2, 3, 4, 5 (it stops before 6).
  2. total goes 1, 3, 6, 10, 15.

Answer: 15

Key idea

Sequence: steps in order. Selection: if/else chooses a path. Iteration: for repeats a set number of times; while repeats while a condition is True. Indentation shows which lines belong inside.

Key words
Sequence
Instructions carried out one after another in order.
Selection
Choosing which code runs using a condition, such as if, elif and else.
Iteration
Repeating code, or visiting each item of a data structure in turn.
Indentation
Spaces at the start of lines showing which code belongs to a block. Python requires it.

All GCSE and International GCSE Computer Science key terms and definitions →

Quick check

Try two quick questions

See if it has sunk in. Answers are marked straight away.

Extra practice

2 more questions

Try each one, then tap to check.

  1. A program checks if a number is even and prints "Even" or "Odd". Which construct is this?

    1. Sequence
    2. Selection
    3. Iteration
    4. Decomposition
    Show the answer

    Answer: Selection

    Choosing a path is selection.

  2. A program prints the numbers 1 to 100 without 100 print lines. Which construct does it use?

    1. Selection
    2. Iteration
    3. Sequence
    4. Abstraction
    Show the answer

    Answer: Iteration

    A loop repeats the print.

Check you have got it

Answer 7 quick questions with instant marking. If you get one wrong, GCSE-ready shows you why and gives you another go. It is free, and you do not need an account.

Video for this lesson coming soon. Subscribe on YouTube

Sources and references

Facts checked against the sources below, 17 October 2026. Last updated 2 October 2026. Spotted a mistake? Tell us and we will fix it.

What do exam command words like explain and evaluate mean? →

Related lessons