Michael House
PRO
last year
Michaelcountry asked

Are the terms and, or, and not considered operators?

Abhay Jajodia
Expert
last year
Abhay Jajodia answered

Hi Michael,

Yes, they are! In Python, and, or, and not are called logical operators. They're used to work with boolean values — True and False — and control the flow of your program based on conditions.

Here’s what each one does:

  • and → returns True only if both conditions are true

  • or → returns True if at least one condition is true

  • not → flips the value: not True becomes False, and vice versa

Example:

age = 23
is_member = True

if age >= 18 and is_member:
    print("You can buy the offer!")
else:
    print("Sorry, offer not available.")

So yes — these are definitely operators, just like + or ==, but used for logic.

If you have more questions, I am here to help.

Python
This question was asked as part of the Getting started with Python course.