Facebook Page Twitter Page LinkedIn Page
× Python Tutorial Python Advanced Python Resources Python Libraries


The Python True keyword is a boolean value. It is returned from a comparison operator and when the result of comparison is True. It is also same as 1 (False is same as 0).

Comparison Scenarios with True Value

In the below example, different comparison scenarios are discussed that lead to True value.

print(10 > 5)

print(10 == 10)

print(10 != 5)

print(10 + 5 > 12)

print(10 is 10)

print(10 is not 5)

print(10 in [1, 5, 10, 15])

print(10 not in [1, 5, 15, 20])

print('hello' is not 'Hello')

print(10 is 5 or 'hello' is not 'Hello')

print(10 is 10 and 'hello' is not 'Hello')

The output of the above code will be:

True
True
True
True
True
True
True
True
True
True
True

❮ Python Keywords