Python's binary operators
Here’s what these binary operators do:
- + - Adds the left operand to the right operand
- - - Subtracts the right operand from the left one
- * - Multiplies one operand by the other
- ** - Multiplies the left operand by itself the number of times specified by the right operand, in exponentiation
- / - Divides the left operand by the right operand, yielding a floating-point number
- // - Integer or floor division, divides the left operand by the right operand then rounds the result to the nearest whole number
- % - Modulus, calculates the remainder of a division operation
Note that both + and - also have unary counterparts. In this case, the - operator flips the sign of the number. The + operator does nothing but exists for symmetry