← VCE Software Development U3O1

Sequence: instructions run in order

A control structure where statements run one after another, top to bottom, so changing their order can change the result.

Understanding Sequence: instructions run in order in VCE Software Development U3O1

What it does: Doubling happens after a is set to 3 and before print, so 6 is shown. Changing the order would change the result. The value must be input before it can be processed, and processed before it can be output, so the order matters. Sequence means statements run one after another from top to bottom. x starts as 5, then the next line changes it to 7 before print(x) runs. (3 + 1) * 2 = 8, but (3 * 2) + 1 = 7. Swapping the statements changes the result. Python runs one line at a time from the top. The calculation needs the input value to exist first.

Common mistakes: The variable total was never created. The statements run in order and the value is stored in score, so the last line should be print(score). This line uses area before it exists. area is only created on line 3, and Python runs the lines top to bottom. It should be height = 3.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 10–47) and word search (Modules 10–71).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
In a program using sequence, which statement runs first?
The statement with the shortest code runs firstThe top statement runs first, then the next one down
Matches
print(area) area = width * height
↓
The output statement is placed before the calculation, so area has no value when it is printed. Move the calculation above print.
Applying
Meanings
Term
sequence
Meaning
A control structure where statements run one after another, top to bottom, so changing their order can change the result.
Practice
price = 12
Testing
Gaps
print("Hi " + )
Check Answer
Spots
2score = score + 5
3print(total)

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Zebra' badge — Pattern Matcher, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. In a program using sequence, which statement runs first?
A. The statement with the shortest code runs first
B. The top statement runs first, then the next one down ✓
Sequence means statements run one after another from top to bottom.
2. What does this code print? x = 5 x = x + 2 print(x)
A. 7 ✓
B. 5
x starts as 5, then the next line changes it to 7 before print(x) runs.
3. What does this code print? x = 4 print(x) x = 9
A. 4 ✓
B. 9
print(x) runs before x is changed to 9, so it shows 4.
4. Two lines are swapped: A: total = 10, then print(total) B: print(total), then total = 10 Which version runs without a NameError?
A. A: total = 10, then print(total) ✓
B. B: print(total), then total = 10
A variable must be given a value before it is used. In B, total does not exist yet when print runs.
5. True or false: swapping two statements in a sequence can change the result of a program.
A. False
B. True ✓
Order matters in sequence. For example, adding then doubling gives a different result from doubling then adding.

Match the Pairs

x = 5 x = x + 2 print(x) → Runs top to bottom and prints 7, because x is changed before it is printed
print(total) total = 10 → Causes an error because total is used before it is given a value
Swapping two statements can change the output, because each line runs in order → a = 3 a = a * 2 print(a) # prints 6
A simple input-process-output program follows sequence: input first, then process, then output → n = int(input()) double = n * 2 print(double)
print(area) area = width * height → The output statement is placed before the calculation, so area has no value when it is printed. Move the calculation above print.
score = 10 print(score) score = score + 5 → The update comes after print, so the output shows 10 instead of 15. Put the update before print.

Key Term

sequence
A control structure where statements run one after another, top to bottom, so changing their order can change the result.

Fill in the Blanks

1. name = input("Name: ") print("Hi " + name)
Hint: Type the variable that stores the input, which was created on the line above.
2. total = 10 total = total + 5 print(total)
Hint: Type the variable that holds the final value after both lines above have run in order.
3. age = int(input("Age: ")) print(age + 1)
Hint: Type the function that converts the typed text into a whole number before it is processed.
4. count = 1 count = count + 1 print(count)
Hint: Type the arithmetic operator that adds to the earlier value so the later line builds on it.
5. print("Start") print("Middle") print("End")
Hint: Type the function name that shows the second message, so the output appears in order.

Spot the Error

Question 1
A score = 10
B score = score + 5
C print(total)
Line C — The variable total was never created. The statements run in order and the value is stored in score, so the last line should be print(score).
Question 2
A width = 4
B height = area / width
C area = width * height
D print(area)
Line B — This line uses area before it exists. area is only created on line 3, and Python runs the lines top to bottom. It should be height = 3.
Question 3
A x = x + 2
B x = x * 3
C print(x)
Line A — This is the first statement, so x has no value yet and Python raises a NameError. The program must start by giving x a value, x = 2.
Question 4
A n = 3
B n = n + 2
C n = n * 2
D print n
Line D — In Python 3, print is a function and needs brackets. The last statement should be print(n), which outputs 10 after the three lines run in order.
Question 5
A age = input('Age: ')
B nxt = age + 1
C print(nxt)
Line B — input() gives a string, so adding 1 to it causes a TypeError. The process step must convert it first: nxt = int(age) + 1.

Student with a class code? Join your class →