Dec-28-2016, 04:47 AM
This page shows the precedence of all operations:
https://docs.python.org/2/reference/expr...precedence
Multiplication and modulo have the same precedence, so they are done in the order they are listed.
Subtraction of course has lower precedence so it is done last.
https://docs.python.org/2/reference/expr...precedence
Multiplication and modulo have the same precedence, so they are done in the order they are listed.
Subtraction of course has lower precedence so it is done last.
>>> 25 * 3 75 >>> 75 % 4 3 >>> 100 - 3 97 >>> 25 * 3 % 4 3 >>> 100 - 25 * 3 % 4 97