Module 2 · Operators · Lesson 3 of 4
Operators and their priorities
When several operators meet in one expression, Python doesn't just work left to right — it follows precedence, a ranking that decides which operation happens first. It's the same “multiplication before addition” rule you learned in school.
* outranks +, so it goes first — even though it's written second.
From highest priority to lowest, the arithmetic operators rank like this:
- ** — exponentiation
- unary + and - (sign)
- *, /, //, %
- binary + and -
Operators on the same level run left to right — with one famous exception. ** goes right to left, so 2 ** 2 ** 3 is 2 ** 8 = 256, not 4 ** 3.
You don't have to memorise the whole ladder. When in doubt — or just to make your intent obvious — wrap the part you want done first in parentheses. They always win, and they make code easier to read. That wraps up the operators; next, a quick quiz.