Full name
bool
Library
Built-in
Syntax
class bool([x])
Description
The bool function converts an x value to its boolean equivalent according to the Truth Value Testing. If x is False or is omitted, the function returns False. In any other case, it returns True.
Parameters
- x : (optional) value to convert to its boolean equivalent.
Examples
By convention, sequences and empty element collections are considered False:
Similarly, numerical values equal to zero are considered False, and the rest are True: