🔹 Operator Precedence
Last Updated: 17th August 2025
It is the order in which the operators are evaluated in an expression.
👉 Higher precedence → evaluated first.
👉 Same precedence → evaluated left to right (except exponentiation ** which is right to left).
Hinglish Tip 🗣:Operator precedence means kis operator ka calculation pehle hoga agar ek hi expression me multiple operators use ho rahe ho.
Precedence Table (Highest → Lowest)
📝 Example
result = 10 + 5 * 2 ** 2
print(result) # 30
#🔎 Breakdown:
# 2 ** 2 → 4 (exponentiation first)
# 5 * 4 → 20 (multiplication next)
# 10 + 20 → 30 (addition last)
💡 Quick Practice
- Predict output: print(100 / 10 * 5 + 2)
- Predict output: print(2 ** 3 ** 2)
- Predict output: print((10 + 2) * 3)
