ProgrammingHardTCS CodeVita · Infosys HackWithInfy

What is printed?

What is printed?
print(sum(1 for c in 'Mississippi' if c in 'aeiou'), 'Mississippi'.count('ss'), 'Mississippi'.rfind('ss'))
  1. A. 3 2 5
  2. B. 4 2 5
  3. C. 0 2 5
  4. D. 4 2 3

Correct answer: B. 4 2 5

The lowercase letter i is a vowel and appears four times in Mississippi. 'ss' appears twice without overlap, and its last occurrence starts at index 5.

More Python Programming questions

Exams that ask this topic