bool() — Easy Examples
Converts a value to a Boolean (True or False)
Basic bool() usage
Simple demonstration of the bool() built-in function.
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).
bool() with different inputs
Calling bool() with various argument types.
python
# More bool() examples print("bool() is a Python built-in function") print(f"Type: {type(bool)}")
bool() accepts different types of arguments and produces corresponding results.
Want to try these examples interactively?
Open Easy Playground