ProgrammingHardTCS NQT · Wipro pattern

What is printed?

What is printed?
print('{0}{1}{0}'.format('x', 'y'))
  1. A. xyx
  2. B. xyy
  3. C. xxy
  4. 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

Exams that ask this topic