741 B
741 B
title | tags | aliases | |||||||
---|---|---|---|---|---|---|---|---|---|
operatorPrecedence |
|
|
[!important] Operator Precedence
Python follows standard math precedence:
**
(exponentiation)*
,/
,//
,%
(multiplication/division)+
,-
(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