ProgrammingHardTCS NQT · Accenture

What is printed?

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

Correct answer: D. True False False

False equals 0 by value, but the two are different objects, so the identity test fails. An empty string is never equal to None.

More Python Programming questions

Exams that ask this topic