Python bool() Function

Example

Return the boolean value of 1:

x = bool(1)

Run Instance

Definition and Usage

The bool() function returns the boolean value of the specified object.

This object will always return True unless:

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

Syntax

bool(object)

Parameter Value

Parameter Description
object Any object, such as strings, lists, numbers, and so on.