ProgrammingVery hardTCS NQT · Accenture
What is printed?
What is printed?
print(float('1e-7'), 0.000001, 1e-6 == 0.000001, 123456789012345678.0)- A. 1e-07 1e-06 True 1.2345678901234568e+17
- B. 1e-7 1e-6 True 123456789012345678.0
- C. 1e-07 1e-06 False 1.2345678901234568e+17
- 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
- What is printed? python print(round(0.5 + 1), round(-0.5 - 1), round(2.5 - 0.0001))
- What is printed? python print(0.1 + 0.2 - 0.3, 0.3 - 0.1 - 0.2, 1 / 49 49, 1 / 10 10)
- What is printed? python import bisect a = [10, 9, 2, 5, 3, 7, 101, 18] tails = [] for x in a: i = bisect.bisectleft(tails, x) if i ==…
- What is printed? python from itertools import product print(list(product('ab', repeat=2)), list(product([0, 1], 'x')))
- What is printed? python d = {'pen': 3, 'cap': 5, 'ink': 3, 'box': 1} print(sorted(d.items(), key=lambda kv: (-kv[1], kv[0]))[:3])
- What is printed? python from collections import deque n = 4 edges = [(0, 2), (1, 2), (2, 3), (0, 3)] indeg = [0] n adj = [[] for in…