ProgrammingVery hardTCS CodeVita · Infosys HackWithInfy
What is printed?
What is printed?
print(str(1e16), str(1e15), str(123456789.0))
- A. 1e+16 1000000000000000.0 123456789.0
- B. 10000000000000000.0 1000000000000000.0 123456789.0
- C. 1e+16 1e+15 123456789.0
- 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
- What is printed? python print(0.1 3, 1.1 1.1)
- What is printed? python print(5 / 2, 5 // 2, -5 / 2, -5 // 2)
- What is printed? python s = 'abc' print(s 0 == '', s[5:] == '', s[-1] + s[0])
- What is printed? python print(divmod(-9, 2), divmod(9, -2))
- What is printed? python x = [1, 2] x += x x = 2 print(x)
- What is printed? python d = dict(zip('abc', range(3))) print(d.popitem(), d)