Computer Science

What will be output produced by following code? State reason for this output.

a = 5 - 4 - 3
b = 323  
print(a)     
print(b)     

Python

Python Data Handling

19 Likes

Answer

-2
6561

Working

    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

Answered By

14 Likes


Related Questions