Boolean variables are like numeric variables. It’s possible to assign expressions, perform operations, and print their values.

To check if two values are equal we can use == operator:

a = 10
b = 20 / 2
print(a == b) # True
c = a == b
print(c) # True
d = 3
print(a == d) # False

Here the expression a == b results in True as 10 is equal to 20 / 2. We can even assign the result of a == b check to another variable c and print its value.

💡

Remember
We use == to check equality.
We use = to assign a value.

In Python, the value of True can be interpreted as 1 and the value of False can be interpreted as 0. So, we can even perform additions and multiplications with boolean values: