ProgrammingHardPython · GATE DA

What is printed?

What is printed?
print(1 < 2 < 3, 3 > 2 > 2, 1 == 1 in [1], not 1 == 2, 2 ** 3 ** 2)
  1. A. True False True True 64
  2. B. True False False True 512
  3. C. True False True True 512
  4. D. True False True False 512

Correct answer: C. True False True True 512

Chained comparisons are joined with and (3 > 2 > 2 is False; 1 == 1 in [1] is True); ** is right associative, so 2 ** 3 ** 2 = 2 ** 9.

More Python Programming questions

Exams that ask this topic