Problem set 1 -- Problem 2

Write a program that prints the number of times the string 'bob'occurs in s. For example, ifs = 'azcbobobegghakl', then your program should print 2.

result = 0
for i in range(len(s)):
    if s[i]== 'b' and s[i:i+3]== 'bob':
        result = result +1
print(result)

results matching ""

    No results matching ""