ProgrammingVery hardTCS NQT · Accenture

What is printed?

What is printed?
print(float('1e-7'), 0.000001, 1e-6 == 0.000001, 123456789012345678.0)
  1. A. 1e-07 1e-06 True 1.2345678901234568e+17
  2. B. 1e-7 1e-6 True 123456789012345678.0
  3. C. 1e-07 1e-06 False 1.2345678901234568e+17
  4. D. 0.0000001 0.000001 True 1.2345678901234568e+17

Correct answer: A. 1e-07 1e-06 True 1.2345678901234568e+17

repr uses scientific notation for values below 1e-4 and at or above 1e16, with at least two exponent digits. The literal 1e-6 and 0.000001 are the same double, and 123456789012345678.0 is rounded to the nearest double.

More Python Programming questions

Exams that ask this topic