Boolean Operations

Boolean operations are used to combine multiple conditions. Let's learn how we are going to use boolean operators in python.

Now we’re ready to learn about Boolean operations (and, or, not). According to the Python documentation, their order of priority is first or, then and, then not. Here’s how they work:

  • or means that if any conditional that is “ored” together is True, then the following statement runs
  • and means that all statements must be True for the following statement to run
  • not means that if the conditional evaluates to False, it is True. This is the most confusing, in my opinion.

Let’s take a look at some examples of each of these. We will start with or.

Get hands-on with 1200+ tech skills courses.