Revise Computingrevisecomputing.co.uk
At a glanceFeaturesStudentsPricingHow it worksFree GCSE notesExam dates
At a glanceFeaturesStudentsPricingHow it worksFree GCSE notesExam dates

Knowledge organisers / Boolean Expressions

Comparison operators

All topicsPractise exam questions
Knowledge organiser

Boolean Expressions

301.8a

== != < > <= >=

What you need to know

Comparison operators compare two values and return True or False. They are used in conditions for if statements, while loops, and other decision structures.

Key points

  • == equal to (not = which is assignment)
  • != not equal to
  • < less than, > greater than
  • <= less than or equal, >= greater than or equal
  • Result is always True or False (a bool)

Code examples

Comparison operators
python
age = 16
print(age == 16)   # True
print(age != 18)   # True
print(age >= 18)   # False
print(age < 21)    # True