ProgrammingHardTCS NQT · Wipro pattern
What is printed?
What is printed?
print('{0}{1}{0}'.format('x', 'y'))- A. xyx
- B. xyy
- C. xxy
- D. xyz
Correct answer: A. xyx
Each placeholder refers to its positional argument by index, so {0} is x each time it appears and {1} is y.
More Python Programming questions
- What is printed? python print(list(filter(None, [0, '', [], [0], None])))
- What is printed? python print([i for i in range(10) if i % 3 == 0][::-2])
- What is printed? python print(set('mississippi') == set('misp'), len(set('mississippi')))
- What is printed? python print(0.1 3 == 0.3, abs(0.1 3 - 0.3) < 1e-9)
- What is printed? python a = [1, 2, 3] print(a[3:], a[1:10], a[-10:1])
- What is printed? python print(len(bytes('é', 'utf-8')), len('é'))