0

I have been stumped by a question I've been asked on an online course. The Question is below in quotes:

Assume s is a string of lower case characters.
Write a program that prints the number of times the string 'bob' occurs in s.
For example, if s = 'azcbobobegghakl', then your program should print: 2.

My code is:

if (True):
    print (s. count ('bob'))

But I get an output of 1 not 2. Can anyone explain to me what I am doing wrong?

SongBird
  • 166
  • 5

0 Answers0