Comparison Operators

noun

say it: “kum-PAIR-ih-sun OP-uh-ray-terz” /kəmˈpærɪsən ˈɑpəreɪtərz/

Symbols that compare two values and answer True or False: == equal, != not equal, <, >, <= and >=.

What are comparison operators?

Comparison operators compare two values and answer True or False: == equal, != not equal, <, >, <= and >=.

age = 17
print(age >= 18)  # False
print(age == 17)  # True

In a sentence

  • “== is one of the comparison operators; a single = is assignment.”
  • “The ticket price uses comparison operators such as age < 13.”

Level: Novice · More Python terms at this level

Updated

In other subjects