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

Preview

Flowcharts and pseudocode

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

Instructions anyone can follow

Write down how to make a cup of tea. Give it to a friend. Can they follow it exactly?

"Boil the water." Which pot? "Add milk." How much? Good instructions are clear, in order and complete.

Before you write code, you plan it in this way.

Key words

WordWhat it means
FlowchartA diagram that shows the steps of a program as symbols joined by arrows.
BCS symbolsThe standard flowchart shapes used in the UK. BCS is the Chartered Institute for IT. Its old name is the British Computer Society.
PseudocodePlanning a program in plain words that look like code. No computer runs it.
SequenceSteps that happen one after another.
SelectionA choice: the program takes one path or another. Also called branching.
LoopSteps that repeat.
IterationDoing steps again and again. Also called a loop.
Control structureSequence, selection or iteration. They control the order of the steps.
Pre-defined codeCode that already exists, such as the built-in tools of a language, and that you reuse.

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

Flowchart symbols

SymbolShapeUse it forExample
TerminatorRounded boxStart and endStart
ProcessRectangleA step that does somethingAdd 1 to total
DecisionDiamondA yes or no question. Two exits.Is age under 16?
Input or outputParallelogramData in or outEnter your age
Pre-defined processRectangle with double side linesCode that already existsCheck the age is a number
Flow lineArrowShows the orderFrom one step to the next

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

Three control structures

StructureIn a flowchartIn pseudocode
SequenceSteps in a lineSET price TO 5, then SET total TO price + 1
SelectionA diamond with two exitsIF age < 16 THEN OUTPUT "child" ELSE OUTPUT "adult" END IF
IterationAn arrow that goes back upFOR i FROM 1 TO 3, OUTPUT i, END FOR

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

Try it: all three in Python

Code: python
# Sequence
price = 4
count = 3
total = price * count

# Selection
if total > 10:
    print("Big order:", total)
else:
    print("Small order:", total)

# Iteration
for i in range(1, 4):
    print("Ticket", i)

# Pre-defined code: len() and sum() already exist
print(sum([2, 4, 6]) / len([2, 4, 6]))

Writing pseudocode

Pseudocode looks like code but is for people. No computer runs it.

Use short capital words for the key ideas: INPUT, OUTPUT, SET, IF, THEN, ELSE, END IF, FOR, END FOR, WHILE. Indent (move to the right) the lines inside an IF or a loop. Write one step on each line. The sign < means "is less than".

The exact words can change from place to place. Pick one style and keep to it.

Read the pseudocode

Have a go

Read the pseudocode

4 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

4 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.