In this python built-in functions tutorial series, we are going to learn all about the Python bool function to get the boolean value of the specified object.
In the previous Python tutorial, we have seen another python built0 function that is a bin function to getting the binary value of a given integer.
What is the Python bool() function?
Python bool function is a built-in python function that is used to return the boolean value of the specific object.
The syntax of bool function in python is:-
bool( object )
bool function in python accepts only one parameter that is object.
- object:- Any object, like String, List, Number, etc.
Return value of bool function is always True or False.
Python bool function example
Here we will use bool function to find the boolean value.
Find the boolean value of 1 using bool() function.
output will be:- True
Find the boolean value of 0 using bool() function.
Output will be:- False
The python bool() function is a built-in function the is used to getting the boolean value of the specified object. bool function in python is very useful to find the boolean value of the specified object.
if you like this article, please keep visit for the next python built-in functions tutorials.
For more information:- Click Here