Python Operators

In this page you can learn most important use of python operators. Operators are special symbols which operate on some values and given some output.

There are some Python supports the following operators

  • Arithmetic Operators.
  • Relational Operators.
  • Assignment Operators.
  • Logical Operators.
  • Membership Operators.
  • Identity Operators.
  • Bitwise Operators.

Arithmetic Operators

OperatorsDescription
//Perform Floor division(gives integer value after division)
+To perform addition
-To perform subtraction
*To perform multiplication
/To perform division
%To return remainder after division(Modulus)
**Perform exponent(raise to power)

Relational Operators:

OperatorsDescription
<Less than
>Greater than
<=Less than or equal to
>=Greater than or equal to
==Equal to
!=Not equal to
<>Not equal to(similar to !=)

Assignment Operators:

OperatorsDescription
=Assignment
/=Divide and Assign
+=Add and assign
-=Subtract and Assign
*=Multiply and assign
%=Modulus and assign
**=Exponent and assign
//=Floor division and assign

Logical Operators:

OperatorsDescription
andLogical AND(When both conditions are true output will be true)
orLogical OR (If any one condition is true output will be true)
notLogical NOT(Compliment the condition i.e., reverse)

Membership Operators:

OperatorsDescription
inReturns true if a variable is in sequence of another variable, else false.
not inReturns true if a variable is not in sequence of another variable, else false.

Identity Operators:

OperatorsDescription
isReturns true if identity of two operands are same, else false
is notReturns true if identity of two operands are not same, else false.