ProgrammingHardTCS CodeVita · Infosys HackWithInfy

What is printed?

What is printed?
print(float('nan') < 0, float('inf') > 10 ** 300, -float('inf') < -10 ** 300)
  1. A. False True True
  2. B. True True True
  3. C. False False True
  4. D. False True False

Correct answer: A. False True True

Any comparison with NaN is False. Infinity is larger than every finite int and -infinity is smaller than every finite int, so the last two are True.

More Python Programming questions

Exams that ask this topic