Python Bool() Function with example

Spread the love

In Python Bool() Function return true for positive and negative values. It returns false for zero or none values.

x = bool(1)
print(x)
x = bool(10)
print(x)
x = bool(100)
print(x)
x = bool(-1)
print(x)
x = bool(0)
print(x)
x= None
print(bool(x))

Output:

True
True
True
True
False
False

admin

admin

Leave a Reply

Your email address will not be published. Required fields are marked *