KS3 · Computer Science
Sequencing instructions in Scratch
Imagine an ATM that checks your PIN before you have typed one. A computer would do exactly that if you wrote the steps in that order.
Computer Science · Programming
A vending machine, one line at a time
The opening lines of a vending machine program, written in Python. The prices are example amounts in coins. Press next and watch which line runs, and what changes.
Before you press next: which line do you think runs straight after drink_price = 4?
1 chocolate_price = 32 crisps_price = 23 drink_price = 44 print("Chocolate costs", chocolate_price)5 print("Crisps cost", crisps_price)6 print("Drink costs", drink_price)7 print("Enter your choice")8 choice = input()
| chocolate_price | crisps_price | drink_price | choice |
|---|---|---|---|
| 3 |
Output
Step 1: Line 1 runs first, and only line 1. chocolate_price now holds 3. Look at the other boxes: still blank. Those lines have not run yet.
Step through the trace — every value is the lesson’s, not run by the page.
Computer Science · Sequence
The same opening lines, as a flow chart
Same program, drawn as symbols. Step through and notice there is only one way to go.
Which symbol runs straight after "crisps_price = 2"?
Output
Step 1: Start at the first symbol. chocolate_price is set to 3.
Step through the trace — every value is the lesson’s, not run by the page.
Computer Science · Control structures
Sequence, selection or iteration?
Which control structure does each description show?
Still to sort
Sequence (0)
Instructions run in the order they appear, one after another.
Where the line is: Nothing here chooses a path or repeats lines. It just carries on to the next instruction.
Selection (0)
More than one path to follow, picked by whether a condition is True or False.
Where the line is: Selection needs a True or False condition and more than one path. Sequence has no such choice.
Iteration (0)
Also called looping: the same lines run more than once.
Where the line is: Iteration repeats the same lines. Sequence just moves on down the program.
Programs are built from three main control structures. Decide which one each description shows, in code and in flow charts.
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
The computer never guesses what you meant to do first.
What you need to know
- Sequence is the order of commands in a program. Instructions run in the order they appear in the code, one after another.
- The computer does not guess what you meant, so the programmer has to put the instructions in the right order.
- The three main control structures are sequence, selection and iteration.
- In a flow chart, sequence is symbols running one after another. Selection is a decision symbol with True and False coming off it.
The big picture
Sequence is the order of commands in a program: instructions run in the order they appear in the code, one after another. It is one of the three main programming control structures, alongside selection and iteration, and the three can be combined to build more complex programs.
Key points
Worked example
Problem
Here is a short program. When it runs, the user types 2 when asked. In what order do the two things on the screen appear, and what is stored in tickets? 1 ticket_price = 5 2 print("Ticket price:", ticket_price) 3 print("How many tickets?") 4 tickets = input()
⚠ Watch out
Thinking the computer will fix a muddled order for you, or run all the lines at once. It does neither. It runs the lines in the order you wrote them, one after another.
Memory hook
Computers follow, they don’t guess: top to bottom, one line after another.
Check yourself
Without looking back: write one sentence explaining what sequence means, then say which control structure a decision symbol with True and False coming off it shows.
Flashcards
(10)What is sequence in a program?
Name the three main programming control structures.
You write your instructions in the wrong order. What does the computer do?
How does a flow chart show sequence?
How does a flow chart show selection?
What is selection? Give an example.
What is iteration? Give an example.
Can a program use more than one control structure?
What order does the ATM program run its steps in?
In the vending machine program, what comes before the prices are printed?
Tap any card to flip it, or use Study as deck to go through them one at a time. In the full lesson these run as a spaced-repetition deck — you rate each card Hard, Good or Easy and the tricky ones keep coming back until they stick.
Learning with Lightbulb is opening soon
You can use this lesson now. Join the waitlist and we'll let you know when the full Lightbulb experience is ready.
Keep me postedMore KS3 Computer Science topics
- Abstraction in computational thinking
- Adding binary numbers
- Binary to denary conversion
- Boolean logic: AND, OR, NOT
- Bubble sort
- Building truth tables
- Client-server vs peer-to-peer
- Collecting and recording data
- Comparing sorting algorithms
- Compressing data
- Creating a 3D animation
- Decomposition: splitting problems up
How this lesson was checked. This KS3 Computer Sciencelesson was published through Lightbulb Learning's human-designed editorial process — the educational standards, accuracy rules and publication checks it must pass were authored and approved by Philip Halpin. It passed subject-specific assessment, automated educational checks and technical publication verification before going live (publication checks completed 9 October 2026). Published pages are monitored, human spot-checking is ongoing across the lesson library, and anything found wrong is corrected or withdrawn. How our lessons are made and checked. Spotted a mistake? Email hello@lightbulblearning.co and we'll review it.