Python: Boolean Type

Python Boolean is in-built data type which is defined by the True or False keywords. Boolean objects that are equal to True are truthy (true), and those equal to False are falsy (false). 

Example:

print(type(True))
print(type(False))

Output:

<class 'bool'>
<class 'bool'>

Example:

a = 3
b = 4
print(a == b)
print(bool(a))

Output:

False
True
Tags