What will be the output of the code given below?

ICSE Class 10 Robotics & AI PYQ · 2025 Paper · Section A

1(xvii)1 Mark · 2025 · Section A · 2025 Paper

What will be the output of the code given below?

st = "This is a test String"
v = st.count("s")
print(v)
Show SolutionHide Solution↓

3

Reason — The count("s") function counts only lowercase occurrences of the character "s" in the string. In the string "This is a test String", the lowercase letter s appears three times. The capital S is not counted because Python is case-sensitive.

← Previous questionNext question →

Browse the free Robotics & AI sample bank