- Arithmetic operators
- Assignment operators
- Comparison operators
- Logical operators
- Membership operators
- Bitwise operators
Operator | Name |
---|---|
+ | Addition |
- | Subtraction |
* | Multiplication |
/ | Division |
% | Modulus |
** | Exponential |
// | Floor Division |
Operator | Description |
---|---|
= | Assign value of right side of expression to left side operand |
+= | Add AND: Add right-side operand with left side operand and then assign to left operand |
-= | Subtract AND: Subtract right operand from left operand and then assign to left operand |
*= | Multiply AND: Multiply right operand with left operand and then assign to left operand |
/= | Divide AND: Divide left operand with right operand and then assign to left operand |
%= | Modulus AND: Takes modulus using left and right operands and assign the result to left operand |
//= | Divide(floor) AND: Divide left operand with right operand and then assign the value(floor) to left operand |
**= | Exponent AND: Calculate exponent(raise power) value using operands and assign value to left operand |
&= | Performs Bitwise AND on operands and assign value to left operand |
|= | Performs Bitwise OR on operands and assign value to left operand |
^= | Performs Bitwise xOR on operands and assign value to left operand |
>>= | Performs Bitwise right shift on operands and assign value to left operand |
<<= | Performs Bitwise left shift on operands and assign value to left operand |
Operator | Description |
---|---|
> | Greater than: True if the left operand is greater than the right |
< | Less than: True if the left operand is less than the right |
== | Less than: True if the left operand is less than the right |
!= | Not equal to – True if operands are not equal |
>= | Greater than or equal to True if the left operand is greater than or equal to the right |
<= | Less than or equal to True if the left operand is less than or equal to the right |
is | x is the same as y |
is not | x is not the same as y |
Operator | Description |
---|---|
and | Logical AND: True if both the operands are true |
or | Logical OR: True if either of the operands is true |
not | Logical NOT: True if the operand is false |
Operator | Description |
---|---|
in | True if value is found in the sequence |
not in | True if value is not found in the sequence |
Operator | Description |
---|---|
& | Bitwise AND |
| | Bitwise OR |
~ | Bitwise NOT |
^ | Bitwise XOR |
>> | Bitwise right shift |
<< | Bitwise left shift |
« Python Fundamental | Conditionals »