I'm confusing with a very simple string count operation:
s = 'BANANA'
s.count('ANA')
This should result in 2, right? Since the substring, ANA
appears 2 times in BANANA
.
But I've got 1 as a result.
>>> s = 'BANANA'
>>> s.count('ANA')
1
No idea why the wrong result. It is such a simple operation!
Appreciate any help.
PS: How can I solve this problem?