title: Keeping count in recursive function
body: <p>I'm trying to figure out how to write a recursive function (with only one parameter) that returns the number of times the substring “ou” appears in the string. Where I'm confused at is that I'm not allowed to use any built-in string functions other than len, or the string operators [] and [:] for indexing and splicing. So I can't use the find built-in find function</p>
  
  <p>I remember seeing something like this, but it uses two parameters and it also uses the find() method</p>
  
  <pre><code>def count_it(target, key):
    index = target.find(key)
    if index &gt;= 0:
      return 1 + count_it(target[index+len(key):], key)
    else:
      return 0
  </code></pre>