How to Use bool() Function
Using the bool() function in Python is very easy. You just need to pass the value as a parameter and it will convert it into a boolean data type.
Let’s understand better how to convert values into boolean data type with a simple example:
bool() in Python
Python bool() function is used to return or convert a value to a Boolean value i.e., True or False, using the standard truth testing procedure.
Example
Python3
x = bool ( 1 ) print (x) y = bool () print (y) |
Output
True False