ProgrammingModerateInfosys HackWithInfy · TCS CodeVita

What is printed?

What is printed?
print(() is (), [] is [], (1, 2) == (1, 2))
  1. A. True False True
  2. B. False False True
  3. C. True True True
  4. D. True False False

Correct answer: A. True False True

CPython reuses one empty tuple object, so () is () is True. Each [] creates a new list, so two empty lists are never the same object.

More Python Programming questions

Exams that ask this topic