AI engineering glossary · Python core
What is comparison operator?
Comparison operator (also called relational operator): An operator that compares two values and returns a boolean: == equal, != not equal, <, >, <= and >=. Python allows chaining, so a < b < c checks both comparisons at once. Comparing floats with == is risky because of rounding.
Comparison operator: an example
score >= 40 returns True for 55. The chained test 0 <= x <= 100 checks that x lies between 0 and 100.
Related terms
More Python core terms
Where you learn it
Comparison operator is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.