ProgrammingHardTCS CodeVita · Infosys HackWithInfy

What is printed?

What is printed?
print(2 ** 3 ** 0, (2 ** 3) ** 0)
  1. A. 2 1
  2. B. 1 1
  3. C. 8 1
  4. D. 2 8

Correct answer: A. 2 1

** is right-associative, so 3 ** 0 is 1 and 2 ** 1 is 2. The parenthesised form is 8 ** 0, which is 1.

More Python Programming questions

Exams that ask this topic