voidex/20-29 Areas/20 Programming/20.01 Python/operatorPrecedence.md

741 B

title tags aliases
operatorPrecedence
python
syntax
operators
math
math order
expression order
operator rules

[!important] Operator Precedence
Python follows standard math precedence:

  1. ** (exponentiation)
  2. *, /, //, % (multiplication/division)
  3. +, - (addition/subtraction)
    Operations are evaluated left to right at each level.
    Use parentheses () to override precedence and clarify expressions.

[!example] Precedence in Practice

2 + 3 * 4     # 14
(2 + 3) * 4   # 20

[!info] Related Notes
arithmeticOperators
expressions
mixedTypeArithmetic
pythonSyntaxOverview