← Python

Comparison Operators

Comparison operators (==, !=, <, >, <=, >=) compare two values and return True or False

Understanding Comparison Operators in Python

What it does: != returns True when the two values are different. 5 != 3 is True. >= is True when the left value is greater than or equal to the right. > means 'greater than' — is 10 greater than 5? == checks if both values are equal. != means 'not equal to' — are 7 and 7 different? < is strictly less than — equal values return False. == is the equality operator, not assignment. Python compares strings alphabetically — 'a' comes before 'b'.

Common mistakes: Use == to compare, not = (which assigns). Greater than or equal is >=, not =>.

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 11–20) and word search (Modules 1–20).

Take this worksheet further — free with Cloodit

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

Learning
Duo
What does 10 > 5 return?
TrueFalse
Matches
❌ if x = 5:
↓
Error: Use == not = to compare
Applying
Meanings
Term
>
Meaning
Greater than - checks if the left value is larger than the right.
Practice
print(10 > 5)
Testing
Gaps
print(10 5)
Check Answer
Spots
1x = 5
2print(5 = 5)

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

The 'Blue-Ringed Octopus' badge — Reef Legend, 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. What does 10 > 5 return?
A. True ✓
B. False
> means 'greater than' — is 10 greater than 5?
2. What does 3 == 3 return?
A. False
B. True ✓
== checks if both values are equal
3. What does 7 != 7 return?
A. False ✓
B. True
!= means 'not equal to' — are 7 and 7 different?
4. What does 4 < 4 return?
A. True
B. False ✓
< is strictly less than — equal values return False
5. What does 5 >= 5 return?
A. True ✓
B. False
>= means 'greater than OR equal to'

Match the Pairs

if x = 5: → Error: Use == not = to compare
if 5 => 3: → Invalid: Use >= not =>
x = 5 x != 3 → Valid: != checks not equal
score >= 50 → Ok: >= means at least 50
print(5 == 5) → Output: True
print(3 > 10) → Output: False

Key Term

>
Greater than - checks if the left value is larger than the right.~~<

Fill in the Blanks

1. print(10 > 5)
2. print(3 == 3)
3. print(7 != 4)
4. print(5 >= 5)
5. print(2 <= 8)

Spot the Error

Question 1
A x = 5
B print(5 = 5)
C print(x + 1)
Line B — Use == to compare, not = (which assigns)
Question 2
A a = 10
B print(10 => 5)
C print(a)
Line B — Greater than or equal is >=, not =>
Question 3
A x = 3
B y = 4
C print(3 =! 4)
Line C — Not equal is !=, not =!
Question 4
A n = 5
B print(5 =< 10)
C print(n)
Line B — Less than or equal is <=, not =<
Question 5
A x = 7
B print(7 < > 3)
C print(x)
Line B — Use != for not equal <> is not valid Python

Student with a class code? Join your class →