bool

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:

Bool function. Example of use

 

Similarly, numerical values equal to zero are considered False, and the rest are True:

Bool function. Example of use

 

Submitted by admin on Sun, 01/20/2019 - 00:30