ProgrammingHardGATE CS & IT · Infosys

What is printed?

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

Correct answer: D. True True

Infinity compares greater than any finite int, even huge ones, and negative infinity compares smaller. Python handles this comparison exactly.

More Python Programming questions

Exams that ask this topic