PYTHON_101 | PYTHON COMPARISON OPERATORS
SMARS Learning Platform
73% Complete
PYTHON_101 | PYTHON COMPARISON OPERATORS
Operator | Symbol | Description | Example |
---|---|---|---|
Equals | == |
If the values of two operands are equal, then the condition becomes true. | (a == b) is not true. |
Not Equal | != |
If values of two operands are not equal, then condition becomes true. | (a != b) is true. |
Not Equal | <> |
If values of two operands are not equal, then condition becomes true. | (a <> b) is true. This is similar to != operator. |
Greater than | > |
If the value of left operand is greater than the value of right operand, then condition becomes true. | (a > b) is not true. |
Less than | < |
If the value of left operand is less than the value of right operand, then condition becomes true. | (a < b) is true. |
Greater or Equal to | >= |
If the value of left operand is greater than or equal to the value of right operand, then condition becomes true. | (a >= b) is not true. |
Less than or Equal to | <= |
If the value of left operand is less than or equal to the value of right operand, then condition becomes true. | (a <= b) is true. |