# Boolean Operators

## `and` and `or` are not guaranteed to return a boolean

When you use `or`, it will either return the first value in the expression if it's true, else it will blindly return the second value. I.e. `or` is equivalent to:

For `and`, it will return its first value if it's false, else it returns the last value:

## A simple example

In Python you can compare a single element using two binary operators--one on either side:

In many (most?) programming languages, this would be evaluated in a way contrary to regular math: `(3.14 < x) < 3.142`, but in Python it is treated like `3.14 < x and x < 3.142`, just like most non-programmers would expect.

## and

Evaluates to the second argument if and only if both of the arguments are truthy. Otherwise evaluates to the first falsey argument.

The `1`'s in the above example can be changed to any truthy value, and the `0`'s can be changed to any falsey value.

## not

It returns the opposite of the following statement:

## or

Evaluates to the first truthy argument if either one of the arguments is truthy. If both arguments are falsey, evaluates to the second argument.

The `1`'s in the above example can be changed to any truthy value, and the `0`'s can be changed to any falsey value.

## Short-circuit evaluation

Python minimally evaluates Boolean expressions.