bool()

Built-in FunctionPython 2.0+Beginner

Converts a value to a Boolean (True or False)

Quick Info

Documentation
Official Docs
Python Version
2.0+

Learn by Difficulty

Quick Example

python
print(bool(1))
print(bool(0))
print(bool(""))
print(bool("hello"))
print(bool([]))

bool() is a built-in function that converts a value to a boolean (true or false).

Try in Playground

Tags

builtinfunctioncoredatatypebooleanconversion

Related Items