count() string method in Python

The count string method returns the number of occurrences of a substring.

Syntax string.count(substring, start, end)

Example:

Python

text = "banana"
print(text.count("a"))   # Output: 3