ProgrammingVery hardJEE Advanced · CAT placement

What is printed?

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

Correct answer: C. True True False True

NaN is never equal to itself, and two infinities of the same sign are equal. inf minus inf is NaN, which is not equal to zero, and minus infinity is smaller than any finite number.

More Python Programming questions

Exams that ask this topic