ProgrammingVery hardProduct-company MCQ pattern

What is printed?

What is printed?
import math
print(math.floor(1e300) == 10**300, math.floor(1e300) == int(1e300), round(1e300) == 10**300)
  1. A. False True False
  2. B. True True False
  3. C. False False False
  4. D. False True True

Correct answer: A. False True False

1e300 is not exactly 10**300 as a double, so the int values differ. floor and int both give the exact value of the double, so they agree, while round gives the same non-matching integer.

More Python Programming questions

Exams that ask this topic