Boolean Data Object

Boolean is named after Mathematician George Boolearrow-up-right.

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:

Truthy and Falsy Values in Python 3

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

Type Conversion Function: bool()

The built-in function to convert one data value to Boolean is: bool()

Last updated