1(xvii)
What will be the output of the code given below?
st = "This is a test String"
v = st.count("s")
print(v)- (a)1
- (b)2
- (c)3
- (d)4
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.