7
Question Question 5b
What will be output produced by following code? State reason for this output.
a = 5 - 4 - 3
b = 3**2**3
print(a)
print(b) Answer
Output
-2
6561
Explanation
a = 5 - 4 - 3
⇒ a = 1 - 3
⇒ a = -2
The exponentiation operator (**) has associativity from right to left so:
b = 3**2**3
⇒ b = 3**8
⇒ b = 6561