The Python Comparison Operators : Comparison Operators « Operator « Python Tutorial





Expression       Description 

x == y           x equals y.
x < y            x is less than y.
x > y            x is greater than y.
x >= y           x is greater than or equal to y.
x <= y           x is less than or equal to y.
x != y           x is not equal to y.
x is y           x and y are the same object.
x is not y       x and y are different objects.
x in y           x is a member of the container (e.g., sequence) y.
x not in y       x is not a member of the container (e.g., sequence) y.










4.4.Comparison Operators
4.4.1.The Python Comparison Operators
4.4.2.Standard Type Value Comparison Operators
4.4.3.multiple comparisons can be made on the same line, evaluated in left-to-right order:
4.4.4.standard comparison operators return a Boolean value indicating the truthfulness of the expression