ProgrammingVery hardTCS CodeVita · Infosys HackWithInfy

What is printed?

What is printed?
import math
print(math.isqrt(10 ** 12), math.isqrt(2 * 10 ** 12) ** 2 <= 2 * 10 ** 12)
  1. A. 1000000 False
  2. B. 999999 True
  3. C. 1414213 True
  4. D. 1000000 True

Correct answer: D. 1000000 True

isqrt(10**12) is exactly 10**6. isqrt(2 * 10**12) is 1414213, whose square is 1999998409369, which is below 2 * 10**12, so the check is True.

More Python Programming questions

Exams that ask this topic