ProgrammingHardTCS NQT · Wipro pattern

What is printed?

What is printed?
print('x'.join('abc'), 'abc'.join('x'))
  1. A. axbxc x
  2. B. axbxc abcx
  3. C. abxbc x
  4. 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

Exams that ask this topic