Question DSA-STR-0006
EasyWhat is the output of this code?
print("banana".count("a"))
- A.
4
- B.
3
- C.
Show answer and explanation
Answer: B
count returns the number of non-overlapping occurrences: "banana" has three a's.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Strings question
What is the output of this code?
print("banana".count("a"))
4
3
Answer: B
count returns the number of non-overlapping occurrences: "banana" has three a's.
1
2