Arithmetic with Boolean Values¶
Boolean values can be used in expressions as if they were numbers. When used in a numerical calculation, Boolean Values are evaluated as follows:
‘True’ evaluates to 1
‘False’ evaluates to 0
We illustrate this concept with a few examples below.
False + True
1
False * True
0
True * 2
2
False * 5
0
True + 5
6
It might seem strange to assign logical values a numerical interpretation, but it is quite common within mathematics and computer science. And, as we will see later, it does have a number of useful applications.