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

Preview

Design the steps with a flowchart

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

45 minutes

A map app plans first

A map app on your phone does not drive the car. It plans the route first. It knows each turn before you reach it.

A good developer plans the steps first too, before writing code. A plan is easier to change than finished code.

In the design task you draw the steps and say how they work.

Key words

WordWhat it meansExample
DesignA plan of how something will work, made before you build it.a flowchart
AlgorithmA list of steps that solves a problem.the steps to check a booking
FlowchartA diagram of steps with arrows.start, check, book
PseudocodeSteps written in plain words that look like code.IF hour < 9 THEN refuse
DecisionA question with a yes or no answer. Each answer goes to a different path.Is the court free?
Edge valueA value right at the limit of what is allowed.hour 9 or hour 20
SymbolA shape in a flowchart. Each shape has one meaning.a diamond

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

Quick check: reading the flowchart

Have a go

Quick check: reading the flowchart

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.

Pseudocode: the same steps in words

Pseudocode is a plan written in plain words. It looks a bit like code but no computer runs it. Each line matches a part of the flowchart.

Pseudocode has no fixed rules. Keep it short and clear. Write every line in the same way.

Flowchart, pseudocode and Python

FlowchartPseudocodePython
Input: hour and courtINPUT hour, courthour = int(input("Hour: "))
Is the hour from 9 to 20? noIF hour < 9 OR hour > 20 THEN output Closedif hour < 9 or hour > 20:
Is the court 1 or 2? noIF court is not 1 or 2 THEN output No such courtif court != 1 and court != 2:
Is it already booked? yesIF (court, hour) is in taken THEN output Takenif (court, hour) in taken:
Output: OKOUTPUT OKreturn "OK"

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

Try it: the flowchart as code

Code: python
def check(hour, court, taken):
    if hour < 9 or hour > 20:
        return "Closed"
    if court != 1 and court != 2:
        return "No such court"
    if (court, hour) in taken:
        return "Taken"
    return "OK"

taken = [(1, 10)]
print(check(10, 1, taken))
print(check(10, 2, taken))
print(check(8, 1, taken))

# < means less than. > means more than.
# != means is not equal to.
# Try hour 21. Try court 3.

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.