Data Structures & AlgorithmsHardTCS NQT Digital · Python semantics

Problem: What does the following print?

Problem: What does the following print?
print(float('inf') > 10 ** 100, -0.0 == 0.0)
What is printed?
  1. A. False True
  2. B. True True
  3. C. True False
  4. D. False False

Correct answer: B. True True

Infinity is larger than any finite integer, and negative zero compares equal to positive zero.

More Coding Interview Problems questions

Exams that ask this topic