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'))- A. 3 2 5
- B. 4 2 5
- C. 0 2 5
- 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
- What is printed? python from math import prod print(prod([]), prod([2, 3, 4]), prod([1.5, 2]))
- What is printed? python print(list(range(10, 0, -3)), list(range(0, -7, -2)), len(range(5, 5)), range(3)[1:])
- What is printed? python s = 'abc' print(s.center(7, ''), s.zfill(5), '-'.join(['x']), s.ljust(2, '.'))
- What is printed? python print(divmod(-9, 4), -9 // 4, -9 % 4, round(-9 / 4))
- What is printed? python d = {'x': 1} e = d d = dict(d) d['x'] = 2 print(e['x'], d['x'])
- What is printed? python nums = [3, 3, 1] print(nums.index(3), nums.count(3), [i for i, v in enumerate(nums) if v == 3])