ProgrammingVery hardTCS CodeVita · Infosys HackWithInfy

What is printed?

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

Correct answer: C. True False

not has lower precedence than is, so not [] is [] means not ([] is []), which is True. (not []) is [] compares True with a new list, which is False.

More Python Programming questions

Exams that ask this topic