ProgrammingHardTCS NQT · Wipro pattern
What is printed?
What is printed?
print('-'.join(map(str, range(3, 0, -1))))- A. 3-2-1-0
- B. 1-2-3
- C. 3-2-1
- D. 2-1-0
Correct answer: C. 3-2-1
range(3, 0, -1) yields 3, 2 and 1, and map(str) converts them before the join. The stop value 0 is never included.
More Python Programming questions
- What is printed? python print('abc'[-1:-4:-1], 'abc'[5:], 'abc'[-10:2])
- What is printed? python print(ord('A') + 1, chr(ord('a') - 32))
- What is printed? python print(divmod(7, -2), 7 % -2)
- What is printed? python print(sum([[1], [2, 3]], []))
- What is printed? python x = (1, [2]) x[1].append(3) print(x)
- What is printed? python print(max([1, 5, 3], key=lambda v: -v))