ProgrammingModerateTCS NQT · Infosys
What is printed?
What is printed?
print(len(''.join(str(i) for i in range(1, 11))), ''.join(str(i) for i in range(1, 11))[-3:], sum(len(str(i)) for i in range(1, 11)))- A. 10 910 11
- B. 11 109 11
- C. 11 910 11
- D. 11 910 10
Correct answer: C. 11 910 11
Ten numbers contribute nine one-digit numbers and one two-digit 10, giving 11 characters. The last three characters are 9, 1 and 0, which spell 910.
More Python Programming questions
- What is the time complexity of checking whether a number n is prime by trial division up to its square root?
- What is printed? python from string import Template print(Template('a-b').substitute(a=1, b=2), Template('ac').safesubstitute(a='x')…
- What is printed? python try: print((300).tobytes(1, 'big')) except OverflowError: print('overflow') print((255).tobytes(1, 'big')…
- What is printed? python print(bool('0'), bool(0.0), bool(-0.0), bool(float('nan')), bool(' '))
- What is printed? python print(True & 2, True | 2, True ^ True, ~True)
- What is printed? python print(-263 // -1 == 263, abs(-263) == 263, (263) (263) > 2127, 263 263 == 2126)