ProgrammingModerateTCS NQT · Wipro pattern

What is printed?

What is printed?
print('Python' * 0 + 'x', 'Py' + 'thon' * 0, len('' * 100))
  1. A. x Python 0
  2. B. x Py 1
  3. C. x Py 0
  4. D. xpy 0

Correct answer: C. x Py 0

Repeating a string zero times gives the empty string, so the first value is just x. Likewise 'thon' * 0 adds nothing, and the empty string repeated stays empty.

More Python Programming questions

Exams that ask this topic