Booleans

Computers operate on the basis of binary logic, where truth is the opposite of false.

Binary logic (ones and zeros)

One of the beautiful things about computer programming, as opposed to other disciplines, is that the truth is universal. In other words, there is no question about what is true. There is no blurring the lines or grey area or different subjective experiences. In programming, truth is objective.

Characteristics

In Python, there are two boolean values: either True or False, with a capital letter, and no quotes:

print(True)
True
print(False)
False

They are the opposite of each other.

Operations

To exemplify the concept of universal truth, we can use the double equals operator (==) to check if these two values are equal to each other:

True == False
False

We see a result of False, in other words it is not the case that they are equal.

See the Python Operators overview for many more example logical operators to use in conjunction with boolean values.