ProgrammingVery hardJEE Advanced · CAT placement

What is printed?

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

Correct answer: C. True False True

The string and the literal 1e308 parse to the same double. That double is slightly above 10**308, so the exact int is less than the float.

More Python Programming questions

Exams that ask this topic