Function Details: bool

Description


Returns a Boolean value, i.e. one of True or False.


Extended Description


The bool() function converts a value to Boolean True or False. It uses the standard truth testing procedure. If x is false or omitted, it returns False; otherwise, it returns True. The bool class is a subclass of int. It cannot be subclassed further. Its only instances are False and True.


Read More about bool from Python Documentation

Function Signature


bool(x: Any = False) -> bool

Module: builtins

Parameters


This function takes one optional parameter: x (any Python object). If omitted, it defaults to False.


Parameter List


  • x: Any

Return


Returns True or False, depending on the truth value of the argument.


Return Type


bool

Output

Explanation

This example shows how bool() evaluates different types of objects.