Logical Operators

noun

say it: “LOJ-ih-kul OP-uh-ray-terz” /ˈlɑdʒɪkəl ˈɑpəreɪtərz/

The words and, or and not, which combine true-or-false checks into one: and needs both to be true, or needs at least one, and not flips the answer.

What are logical operators?

Logical operators combine True/False checks: and needs both to be true, or needs at least one, and not flips True to False.

has_ticket = True
is_vip = False
print(has_ticket and is_vip)  # False
print(has_ticket or is_vip)   # True
print(not is_vip)             # True

In a sentence

  • “With logical operators, one if can ask whether the order is paid or the customer has store credit.”
  • “The ticket check uses logical operators to let in anyone who has a ticket and isn't on the banned list.”

Level: Novice · More Python terms at this level

Updated

In other subjects