Question #709

What is the output of the code snippet below?
x = 36 / 4 * (3 +  2) * 4 + 2
print(x)

Python implements the concept of operator precedence. * and / generally take precedence over + and - . Here, the calculation starts with 36 / 4 making 9. Then 9 multiplied by (3+2) making 45. Then 45 is multiplied by 4 making 180, to which 2 is added making 182. (docs.python.org/3/reference/expressions.html#operator-pre...)


Comment on Disqus:

Comment on Twitter:

Question difficulty: 🔵🔵🔵🔵🔵