ProgrammingVery hardTCS CodeVita · Infosys HackWithInfy

What is printed?

What is printed?
print(str(1e16), str(1e15), str(123456789.0))
  1. A. 1e+16 1000000000000000.0 123456789.0
  2. B. 10000000000000000.0 1000000000000000.0 123456789.0
  3. C. 1e+16 1e+15 123456789.0
  4. D. 1e16 1000000000000000.0 123456789.0

Correct answer: A. 1e+16 1000000000000000.0 123456789.0

repr switches to exponent notation for floats of 1e16 and above. Below that, 1e15 is printed in full with a trailing .0.

More Python Programming questions

Exams that ask this topic