PythonBuilt-inbool
float

boolBuilt-in

list

Converts a value to a Boolean.

Syntax

bool(x?)

Example

Enter values below to update the example in real time.

print
print(bool(0))    # False
print(bool(1))    # True
print(bool(""))   # False
print(bool("hi")) # True