bool() Function in Python

By Hemanta Sundaray on 2021-08-19

In Python, we can use the bool() function to convert any data type to a boolean (True or False).

Example:

print(bool(0))
# False

print(bool(1))
# True

print(bool(True))
#True

print(bool(False))
#False

Join the Newsletter