ProgrammingModerateTCS NQT · Wipro pattern

What is printed?

What is printed?
print(10 == 10.0 and 'a' == 'a', 1 < 2 or 1 / 0)
  1. A. True False
  2. B. True True
  3. C. False True
  4. D. ZeroDivisionError

Correct answer: B. True True

Both sides of the and are True, so the result is True. The or short-circuits when 1 < 2 is True, so 1 / 0 is never evaluated.

More Python Programming questions

Exams that ask this topic