Python bool() Function
The python bool() method converts value to boolean (True or False) using the standard truth testing procedure.
Signature
Parameters
It is not mandatory to pass value to bool(). If you do not pass the value, bool() returns False.
In general , bool() takes a single parameter value.
Return
The bool() returns:
- False if the value is omitted or false
- True if the value is true
Python bool() Function Example
Output:
[] is False [0] is True 0.0 is False None is False True is True Easy string is True
0 comments:
Post a Comment
Thanks