Python True Keyword
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 example below, different comparison scenarios are discussed that lead to True value.
x = [10, 20, 30] y = x z = [10, 20, 30] print(10 > 5) print(10 == 10) print(10 != 5) print(10 + 5 > 12) print(x is y) print(x is not z) print(10 in [1, 5, 10, 15]) print(10 not in [1, 5, 15, 20])
The output of the above code will be:
True True True True True True True True
❮ Python Keywords