Python Comparison Operators

These operators compare the values on either sides of them and decide the relation among them. They are also called Relational operators.
Assume variable a holds 10 and variable b holds 20, then −
OperatorDescriptionExample
==If the values of two operands are equal, then the condition becomes true.(a == b) is not true.
!=If values of two operands are not equal, then condition becomes true.(a != b) is true.
<>If values of two operands are not equal, then condition becomes true.(a <> b) is true. This is similar to != operator.
>If the value of left operand is greater than the value of right operand, then condition becomes true.(a > b) is not true.
<If the value of left operand is less than the value of right operand, then condition becomes true.(a < b) is true.
>=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.
<=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.

Comments

Popular posts from this blog

How to add Internet download manager extension in the Chrome browser

A Day in Noida: Learning Begins

Python Deciding factor