bool(x=False)
Convert a value to bool using standard truth testing.
Parameters
The bool() function accepts one parameter:
- x — the value to evaluate
Return Value
- Returns
Falseifxis false or not specified; otherwise, returnsTrue.
Examples
bool(1) # True
bool() # False
bool(0) # False
bool('Hello') # True
bool('') # False