Boolean Data Object
Last updated
Last updated
Boolean is named after Mathematician .
The Boolean data type allow us to implement logic in our code by simplifying statements to be either True or False.
There are two Boolean data-typed possible values in Python.
True
False
Usage:
We can set variables with Boolean values
We can get them as a result from
Certain functions and methods will result in a Boolean value as well
In programming (Python), certain values can be also True or False in Conditional Situations. We call these Truthy or Falsy values.
The rules are as follows:
Idea of Emptiness is False
→ Keyword: None
is False
Therefore, 0, '', "" , []
are all empty → False
1 represents “ON” in binary → True
; 0 → False
Lastly, ANY NON-FALSY values are True
bool()
The built-in function to convert one data value to Boolean is: bool()