In this tutorial, we are going to learn about the bool() built-in function. bool() is used to return or convert a value to boolean [True or False]. bool() will take 0 or 1 argument.
Syntax
bool(x)
If the value x is True, then it returns True otherwise it returns False. If you don't pass any argument to the bool(), then it will return False.
Example
print(bool(None)) print(bool(())) print(bool([])) print(bool(0)) print(bool(0.0)) print(bool({})) print(bool('')) print(bool(False))
Output
If you run the above program, you will get the following results.
False False False False False False False False
Conclusion
If you have any doubts in the tutorial, mention them in the comment section.