Python bool() Function
The bool() function returns the boolean value of a specified object
title (True or False).
The object will always return True, unless:
- The object is empty, like [], (), {}, ""
- The object is False
- The object is 0
- The object is None
Syntax
bool(object)
Parameters
| Parameter | Description |
|---|---|
object |
Required. The object to convert |
Return Value
Boolean. True or False.
Example
Using the bool() function:
Output
Click Run to execute your code
Enjoying these tutorials?