An operators are used to perform a mathematical operation on single or multiple operands. There are various operators available in Python, which are categorized into 5 parts-
Arithmetic Operators:-
| Operator | Description |
|---|---|
| + | Addition |
| - | Subtraction |
| * | Multiplication |
| / | Division |
| % | Modulus (Remainder of a division) |
| ** | Exponentiation |
| // | Floor Division |
Assignment Operators:-
| Operator | Description |
|---|---|
| = | Assign |
| += | Add and assign |
| -= | Subtract and assign |
| *= | Multiply and assign |
| /= | Divide and assign |
| %= | Modulus and assign |
| //= | - |
| **= | - |
| &= | - |
| |= | - |
| ^= | - |
| >>= | - |
| <<= | - |
Comparison Operators:-
| Operator | Description |
|---|---|
| Operator | Description |
| == | Equal to |
| != | Not equal to |
| > | Greater than |
| >= | Greater than or equal to |
| < | Less than |
| <= | Less than or equal to |
Boolean or Logical Operators:-
| Operator | Description |
|---|---|
| and | Logical AND |
| or | Logical OR |
| not | Logical NOT |
Identity Operators:-
| Operator | Description |
|---|---|
| is | - |
| is not | - |
Membership Operators:-
| Operator | Description |
|---|---|
| in | - |
| not in | - |
Bitwise Operators:-
| Operator | Description |
|---|---|
| & | - |
| | | - |
| ^ | - |
| ~ | - |
| << | - |
| >> | - |