ProgrammingHardTCS NQT · Infosys

What is printed?

What is printed?
print(sum(1 for c in 'Mississippi' if c in 'aeiouAEIOU'), 'Mississippi'.lower().count('s'), 'Mississippi'.find('ss', 3))
  1. A. 4 2 5
  2. B. 4 4 5
  3. C. 3 4 2
  4. D. 4 4 2

Correct answer: B. 4 4 5

Mississippi has four vowels, all i, and four s letters. find('ss', 3) skips the first ss at index 2, so the match at index 5 is returned.

More Python Programming questions

Exams that ask this topic