Learning Python: Boolean Operators
When working with boolean, Python has the following operators:
If you have variables that have the values of either true or false, these operators work like
a = true b = false not a #False a and b #False a or b #True
OR returns the first non-falsy value. When using
AND, the second argument is evaluated only if the first argument is true.
- A falsy value is a value which when evaluated will return
false. For example, some falsy values are:
This blog post was originally published on my blog Communicode, where I write about different tech topics.