Comparison Operators, online
Six activities your students do on their own devices. See who's finished, and their scores.
Learning
Understanding
Testing
Comparison Operators in one minute
What students need to know
!= 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.
Mistakes students make
- Use == to compare, not = (which assigns).
- Greater than or equal is >=, not =>.
- Not equal is !=, not =!
- Less than or equal is <=, not =<.
PREVIOUS · MODULE 11Type Conversion
YOU ARE HERE · MODULE 12Comparison Operators
NEXT · MODULE 13Boolean Logic
What students will learn in this module
Every question in Module 12
Quick questions
- What does 10 > 5 return?ATrueBFalse
- What does 3 == 3 return?AFalseBTrue
- What does 7 != 7 return?AFalseBTrue
- What does 4 < 4 return?ATrueBFalse
- What does 5 >= 5 return?ATrueBFalse
Key terms
Students type the meaning of:
><==!=
Match the pairs
if x = 5:Match it to what it doesif 5 => 3:Match it to what it doesx = 5 x != 3Match it to what it does
score >= 50Match it to what it doesprint(5 == 5)Match it to what it doesprint(3 > 10)Match it to what it doesFill in the blanks
print(10 _ 5)
print(3 __ 3)
print(7 __ 4)
print(5 __ 5)
print(2 __ 8)
Spot the error
Question 1
Ax = 5Bprint(5 = 5)Cprint(x + 1)
Question 2
Aa = 10Bprint(10 => 5)Cprint(a)
Question 3
Ax = 3By = 4Cprint(3 =! 4)
Question 4
An = 5Bprint(5 =< 10)Cprint(n)
Question 5
Ax = 7Bprint(7 < > 3)Cprint(x)
