Python True Keyword
Definition and Usage
The True
keyword is a Boolean value, and
result of a comparison operation.
The True
keyword is the same as 1 (False
is the same as 0).
More Examples
Example
Other comparisons that returns True:
print(5 < 6)
print(2 in [1,2,3])
print(5 is 5)
print(5 == 5)
print(5 == 5 or 6 == 7)
print(5 == 5 and 7
== 7)
print("hello" is not "goodbye")
print(not(5 ==
7))
print(4 not in [1,2,3])
Run example »
Related Pages
The False
keyword.
Read more about comparisons in our Python Operators Tutorial.