The quiz where the difficulty automagically adapts to the player's Python knowledge
This is a question page. You can use this page to bookmark a question. Start a new quiz!
Question #709
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...)
What is the output of the code snippet below?
— The Python Quiz (@thepythonquiz) May 6, 2021
x = 36 / 4 * (3 + 2) * 4 + 2
print(x)
117.0
37.0
It will throw a SyntaxError exception.
182.0
112.0
π Comment the answer, like and retweet! #python
Question difficulty: π΅π΅π΅π΅π΅