Post a New Question

Computer Programming using python

posted by .

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

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 -

    s = "azcbobobegghakl"

    search = "bob"

    print len([i for i in range(len(s)) if s.startswith(search, i)])

  • Computer Programming using python -

    What is the code?

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

More Related Questions

Post a New Question