ProgrammingModerateTCS NQT · Infosys

What is printed?

What is printed?
print('Mississippi'.lower().count('s'), 'Mississippi'.find('ss'), 'Mississippi'.rfind('ss'))
  1. A. 4 2 5
  2. B. 4 2 2
  3. C. 3 2 5
  4. D. 4 3 5

Correct answer: A. 4 2 5

Lowercasing gives four s letters. find returns the first 'ss' at index 2, and rfind returns the last one, at index 5.

More Python Programming questions

Exams that ask this topic