Python bool() class

The bool() class in Python returns the boolean value for the specified object.

Syntax

Parameter

object: This parameter represents the object, like String, List, Number etc.

Return

It will always return True, except for the following cases where it returns False:

  • The object is empty, like [], (), {}
  • The object is False
  • The object is 0
  • The object is None

Example 1

Output

Pin It on Pinterest

Share This