GCSE · Computer Science · Edexcel · Spec 1CP2
Programming relational operators
Same ages. Same rule shape. Change one symbol and the age of 12 flips from False to True.
Computing · Conditions
True or False? Same ages, different operator
For the rule shown, is the condition True or False when age holds this value?
Is age > 12 True or False for each age?
Still to sort
True (0)
The comparison holds for this age.
Where the line is: Read the operator, not just the numbers: the same age can sit here under one rule and in False under another.
False (0)
The comparison does not hold for this age.
Where the line is: Equal values are the troublemaker. Whether 12 lands here depends on whether the operator accepts 'equal'.
Each rule below asks one question about the value held in age. Sort every age into True or False, then switch the rule and sort the same ages again. Watch the age of 12.
Predict, then check
Same boundary idea, mirrored. A lift sign says 'at most 8 people'.
Which condition checks that rule, with people holding the number in the lift?
Computing · Selection
Which path does the program take?
The program checks number against each condition in order. Pick a result for the first check, then the second, and see where the program ends up.
First condition (if) → Second condition (elif)
3 possible routes.
if number > 5: add 5, else: subtract 5. That is a two-way choice. Now slot an elif in the middle and walk each path. Only one path ever runs.
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
Compare two values, get True or False, and let that answer steer your program.
What you need to know
- A relational operator compares two values and gives back True or False.
- There are six: == equal to, != not equal to, < less than, <= at most, > greater than, >= at least.
Have a goBefore you read on: what does 7 != 7 give, True or False?
False
!= asks 'are these different?' and 7 is not different from 7, so the answer is False.
- In Python, == compares two values. A single = assigns, so age = 12 stores 12 in age.
- A condition is any expression that works out to True or False, like 5 > 10 (False).
- At the boundary, > and >= split: with age 12, age > 12 is False but age >= 12 is True.
Have a goYour classmate is exactly 12 and says, "I'm more than 12, so age > 12 lets me in!" Is that right? What would you change?
No. age > 12 is False for 12. Use age >= 12.
> leaves out the boundary value 12, while >= accepts 'equal', so it covers 12 or over.
- Selection is for when a program has more than one possible path to follow.
- In if, elif and else, the branch that runs is the first one whose condition returns True.
Have a gonumber holds 6. Both number > 5 and number > 2 are True. Which branch runs: the if, the elif, or both?
Only the if branch.
The first condition that returns True wins, and the program skips everything after it.
- A password check uses if password == stored_password: to choose between Access granted and Access denied.
The big picture
Relational operators compare two values and give True or False. Use == to compare and = to assign, watch the boundary between > and >=, and use the resulting condition in selection to choose which path a program follows.
Key points
Worked example
Problem
A shop gives free delivery when the basket total is at least 30 pounds. Write the condition, then work out what it gives for baskets of 29, 30 and 45 pounds.
⚠ Watch out
Writing = when you mean ==. A single = assigns a value, so age = 12 stores 12 in age. It does not ask whether age is 12.
Memory hook
One equals sign STORES, two equals signs ASK. And 'at least' means the boundary is in: >=.
Check yourself
Without looking back: if score holds 40, what do score >= 40 and score > 40 give, and why do they differ?
Flashcards
(12)What does a relational operator do?
Which relational operator reads as 'at least'?
Which relational operator reads as 'at most'?
What does != mean, and when is it True?
In Python, what is the difference between = and ==?
What is a condition?
age holds 12. Is age > 12 True or False?
Which condition writes the rule 'everyone aged 12 or over'?
In if / elif / else, which branch runs?
Evaluate 10 == 10, 10 != 10 and 12 <= 13.
When is selection used in a program?
In the password check, what is output when password == stored_password is True?
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 Edexcel GCSE Computer Science topics
- Programming – count-controlled repetition
- Programming – iteration over data structures
- Programming – selection
- Programming – sequencing
- Programming arithmetic operators
- Programming logical operators
- Reading, writing, analysing and refining programs
- Single entry/exit code blocks
- String manipulation
- Structural components of programs
- Structured data types
- User input handling
How this lesson was checked. This Edexcel GCSE Computer Science (specification 1CP2)lesson 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 21 November 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.