Comparison Operators, online

Six activities your students do on their own devices. See who's finished, and their scores.

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

Discover other journeys with this module

What students will learn in this module

Every question in Module 12

Quick questions

  1. What does 10 > 5 return?ATrueBFalse
  2. What does 3 == 3 return?AFalseBTrue
  3. What does 7 != 7 return?AFalseBTrue
  4. What does 4 < 4 return?ATrueBFalse
  5. What does 5 >= 5 return?ATrueBFalse

Key terms

Students type the meaning of:

  • >
  • <
  • ==
  • !=

Match the pairs

if x = 5:Match it to what it does
if 5 => 3:Match it to what it does
x = 5
x != 3
Match it to what it does
score >= 50Match it to what it does
print(5 == 5)Match it to what it does
print(3 > 10)Match it to what it does

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

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)