Python For GCSE
Comparison Operators
In order to express the conditions needed in conditional statements, we need the following comparison operators.
Operator | Meaning |
---|---|
== | Equal to |
!= | Not equal to |
< | Less than |
<= | Less than or equal to |
> | Greater than |
>= | Greater than or equal to |
We use two equals signs when comparing items. A single equals sign is used for assigning values. Forgetting to use two signs is a common mistake, as is getting the greater and less than signs mixed up.
When conditional expressions are evaluted by Python, they will give one of two results,
True False