I am trying to find the # of times a substring, in this case 'bob' appears in a string. My solution works for some strings, but not for all. For example, the answer to the following should be 7, but I am returning 5.
Any ideas why?
Thanks
s = 'bobbisbobobugbobobbobbobo'
print('Number of times bob occurs is: ', s.count('bob'))