ProgrammingHardTCS CodeVita · Infosys HackWithInfy
What is printed?
What is printed?
print(len(str(2 ** 1000 * 5 ** 1000)))
- A. 302
- B. 1000
- C. 1001
- D. 1002
Correct answer: C. 1001
2**1000 * 5**1000 = 10**1000, which has 1001 digits. A naive guess would use the size of 2**1000, which has only 302 digits.
More Python Programming questions
- What is printed? python rows = [(2, 'b'), (1, 'z'), (2, 'a'), (1, 'y')] print(sorted(rows, key=lambda t: (-t[0], t[1])))
- What is printed? python print(sorted(['bb', 'a', 'cc', 'd', 'ee'], key=len, reverse=True))
- What is printed? python import bisect a = [1, 2, 2, 2, 3] print(bisect.bisectleft(a, 2), bisect.bisectright(a, 2), bisect.bisectright(a…
- What is printed? python import bisect print(bisect.bisectleft([5, 4, 3], 4))
- What is printed? python import bisect print(bisect.bisectleft([(1, 'a'), (3, 'b'), (5, 'c')], 3, key=lambda t: t[0]))
- What is printed? python import bisect a = [(1, 'x'), (4, 'y')] bisect.insort(a, (3, 'z'), key=lambda t: t[0]) print(a)