2.2. Arithmetic operations
The operators for addition, subtraction, multiplication and division shouldn’t be too complicated. They work as you probably expected. However, it should be noted that when using multiple operators, it is recommended to group expressions using parentheses – the operations within the parentheses are performed first. For example, the expression
a = b * c – d% e / f may be confusing in terms of the order of computation. But it is allowed to clarify it by writing it in the form:
a = (b * c) – ((d% e) / f)
The% (modulo) operator divides one number by another and returns the remainder of the division. It is very useful for determining whether a number is even or odd.
The // (integer division) operator works the same as normal division, /, but discards the result after the decimal point.
The ** (exponentiation) operator raises the first operand to the power of the second operand.