ProgrammingHardTCS NQT · Wipro pattern
What is printed?
What is printed?
print('x'.join('abc'), 'abc'.join('x'))- A. axbxc x
- B. axbxc abcx
- C. abxbc x
- D. axbxc xabc
Correct answer: A. axbxc x
join puts the separator between the items: x between a, b and c gives axbxc. A one-character string has no separators between its items, so 'abc'.join('x') is just x.
More Python Programming questions
- What is printed? python print(True + True, 3 True, 'ab' True)
- What is printed? python print('%.3e' % 12345.678)
- What is printed? python print(sorted([3, 1, 2], reverse=True) == [3, 2, 1], [3, 1, 2][::-1])
- What is printed? python print([0] 3 == [0, 0, 0], [[]] 2 == [[], []])
- What is printed? python print(len([x for x in range(100) if x % 7 == 0]), sum(range(0, 100, 7)))
- What is printed? python print(round(-2.5), round(-3.5), round(-2.5 - 1e-9))