ProgrammingHardProduct Company SDE · Python internals

What does the following Python 3 code print? print([] == False, [] is False)

  1. A. False True
  2. B. False False
  3. C. True True
  4. D. True False

Correct answer: B. False False

[] is falsy in a boolean context but it is never equal to the bool False, and 'is' checks identity, which also fails here.

More Python Programming questions

Exams that ask this topic