Comparison Operators
What are Comparison Operators
Also know us relational operators, are those operators that are used to compare values for equality, inequality and so on.
Equalality operator
The equality operator represented by ==
checks if two object are equals, then either returns True
if the two objects(operands) are equal, else returns False
when they are equal.
Example
Inequality operator
Inequality operator represented by !=
checks whether two objects(operands) are not equal, then it returns True
if they are equal, else it returns False
.
Example
Greater than
Greater than operator symbolised by >
compares if the left operand(value) is greater than the right operand(value). Returns True if greater than and False if not
Example
Less than
Less than operator represented by <
compares if the left operand(value) is less than the right operand(value). Returns True if less than and False if not
Example
Greater than or equal
Greater than or equal operator checks if the operand(value) on the left side is greater than or equals to the operand(value) on the right side.
Example
Less than or equal
Less than or equal operator symbolised by <=
checks if the operand(value) on the left side is less than or equals to the operand(value) on the right side.