KS3 · Computer Science
Selection: making decisions in code
The same theme park ticket program charges a 9-year-old 18 and a 14-year-old 25. It asks one question about age, gets True or False, and follows just one path.
Computer Science · Selection
The ticket program’s fork
One visitor, aged 9. Step through and watch which path lights up, and which one never does.
Before you press Next: will a 9-year-old be charged 25 or 18?
Output
Step 1: The ticket program starts.
Press Next and follow the lit-up path. Watch the other price box.
Computer Science · Conditions
Make the call: True or False?
Pick a card, then pick the box it belongs in. Commit first, then read why.
Still to sort
Evaluates to True (0)
The comparison holds for those values.
Where the line is: When the two values are equal, >= and <= give True but > and < give False.
Evaluates to False (0)
The comparison does not hold for those values.
Where the line is: False is a proper result, not an error. It is what sends a program down its other path.
A condition is just a question your program can answer with True or False. Each card shows a variable’s value and a condition.
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
What you need to know
- Selection means a program has more than one possible path and picks one by checking a condition that evaluates to True or False.
- In a flowchart, selection is a decision symbol with a True path and a False path coming off it.
- In Python, selection uses if and else: the if block runs when the condition is True, the else block runs when it is False, and only one of them runs.
- = assigns a value to a variable. == compares two values.
- The logical operators and, or and not join conditions into a single True or False result.
- The main control structures are sequence, selection and iteration.
The big picture
Selection lets a program choose between paths by checking a condition that evaluates to True or False. In Python you write it with if and else, and only one of the two blocks ever runs.
Key points
Worked example
Problem
A program has a variable called user. Write Python that outputs "Welcome back" if user is equal to the string "Alex", and outputs "Please sign up" if it is not.
⚠ Watch out
Two slips catch people out. One: writing = when you mean ==. = is for assignment, so if pin = 1234: is a syntax error. Two: thinking the if block and the else block both run. Never. The condition is True or False, and that picks exactly one block.
Memory hook
One equals puts it in. Two equals asks the question.
Check yourself
age is 12. What does age > 12 evaluate to? What does age >= 12 evaluate to? Which of the two would send a program down its if block?
Flashcards
(14)What is selection?
What is a condition?
In a flowchart, what shows selection?
In Python, when does the else block run?
What is the difference between = and == in Python?
Which operator means “not equal to”?
What does >= mean?
If age is 12, what does age > 12 evaluate to?
Which Python rules apply to if and else syntax?
When is A and B True?
When is A or B True?
What does not do?
Name the three main control structures.
What does iteration do?
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.