Exponentiation Precedence in Python
The exponentiation operation takes precedence over multiplication and division. The following example will first perform the exponentiation and then the multiplication:
print(2 * 2 ** 3) # 16
The following code is given:
res = 2 * 3 ** 2
print(res)
Tell me what will be output to the console.
The following code is given:
res = (7 + 4) * (3 - 1) ** 3
print(res)
Tell me what will be output to the console.