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
Number of times bob occurs is: 2
For problems such as these, do not include raw_input statements or define the variable s in any way. Our automating testing will provide a value of s for you - so the code you submit in the following box should assume s is already defined. If you are confused by this instruction, please review L2 Problems 10 and 11 before you begin this problem set.
Computer Programming using python - Anonymous, Sunday, October 27, 2013 at 12:24pm
s = "azcbobobegghakl"
search = "bob"
print len([i for i in range(len(s)) if s.startswith(search, i)])
Computer Programming using python - Anonymous, Saturday, June 21, 2014 at 12:45pm