πŸ“Š Problem Solving and Python Programming
Q. What are the values of the following
Python expressions?
2**(3**2)
(2**3)**2
2**3**2
  • (A) 64, 512, 64
  • (B) 64, 64, 64
  • (C) 512, 512, 512
  • (D) 512, 64, 512
πŸ’¬ Discuss
βœ… Correct Answer: (D) 512, 64, 512

Explanation: Expression 1 is evaluated as:
2**9, which is equal to 512. Expression 2 is
evaluated as 8**2, which is equal to 64. The
last expression is evaluated as 2**(3**2).
This is because the associativity of **
operator is from right to left. Hence the result
of the third expression is 512.


Explanation by: Mr. Dubey
Expression 1 is evaluated as:
2**9, which is equal to 512. Expression 2 is
evaluated as 8**2, which is equal to 64. The
last expression is evaluated as 2**(3**2).
This is because the associativity of **
operator is from right to left. Hence the result
of the third expression is 512.

πŸ’¬ Discussion

πŸ“Š Question Analytics

πŸ‘οΈ
1038
Total Visits
πŸ“½οΈ
3 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
91%
Success Rate