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
What will be output produced by following code? State reason for this output.
a, b, c = 1, 1, 1 d = 0.3 e=a+b+c-d f=a+b+c == d print(e) print(f)
What will be output produced by following code? State reason for this output.
a, b, c = 1, 1, 2 d = a + b e = 1.0 f = 1.0 g = 2.0 h = e + f print(c == d) print(c is d) print(g == h) print(g is h)
What will following code print?
a = 3 b = 3.0 print (a == b) print (a is b)
What will be the output of following Python code?
a = 12 b = 7.4 c = 1 a -= b print(a, b) a *= 2 + c print(a) b += a * c print(b)