Arithmetic operators
Arithmetic operators are used to perform mathematical operations like addition, subtraction, multiplication, etc.
| Operator |
Meaning |
Example |
| + |
Add two operands or unary plus |
x + y+ 2 |
| - |
Subtract right operand from the left or unary minus |
x - y- 2 |
| * |
Multiply two operands |
x * y |
| / |
Divide left operand by the right one (always results into float) |
x / y |
| % |
Modulus - remainder of the division of left operand by the right |
x % y (remainder of x/y) |
| // |
Floor division - division that results into whole number adjusted to the left in the number line |
x // y
|
| ** |
Exponent - left operand raised to the power of right |