when executing the command in python
str="BANANA"
print(str.count("ANA"))
give answer as 1.
but real answer would be 2. how to solve this
when executing the command in python
str="BANANA"
print(str.count("ANA"))
give answer as 1.
but real answer would be 2. how to solve this
It's true that this might be misleading most tutorial sites say that count returns the number of occurences in the string, it should actually say it returns the nnumber of non-overlapping occurences in the string