Boolean Data Type

Last updated: Apr 12, 2026

2.1.3 Boolean

Boolean data type consists of one of the two built-in values, True or False. Boolean objects that are equal to True are truthy (true), and those equal to False are falsy (false). But non-boolean objects can be evaluated in boolean context as well and determined to be true or false. It is denoted by the class bool. True and False with capital 'T' and 'F' are valid booleans otherwise python will throw an error.

Example:

# Python program to demonstrate boolean type
print(type(True))
print(type(False))
print(type(true))

Output:

<class 'bool'>
<class 'bool'>
NameError: name 'true' is not defined