ProgrammingModerateProduct-company MCQ pattern

What is printed?

What is printed?
print(float('nan') < 1, float('nan') > 1, float('nan') != float('nan'))
  1. A. True False True
  2. B. False False True
  3. C. False True False
  4. D. False False False

Correct answer: B. False False True

Every ordering comparison with NaN is False, and NaN is not equal to itself. Checking for NaN requires math.isnan, not a comparison.

More Python Programming questions

Exams that ask this topic