Python True Keyword

❮ Python Keywords


Example

Print the result of the comparison "7 is larger than 6":

print(7 > 6)
Try it Yourself »

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])
Try it Yourself »

Related Pages

The False keyword.

Read more about comparisons in our Python Operators Tutorial.


❮ Python Keywords

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.