title: python pattern count Find a “hidden message” in the replication origin
body: <p>The question ask to find a “hidden message” in the replication origin.</p>
  
  <pre><code>Input: A string Text (representing the replication origin of a genome).
  
  Output: A hidden message in Text.
  </code></pre>
  
  <p>Translate to computational language,</p>
  
  <pre><code>Input: Strings Text and Pattern.
  
  Output: Count(Text, Pattern).
  </code></pre>
  
  <p>For example, </p>
  
  <pre><code>Count(ACAACTATGCATACTATCGGGAACTATCCT, ACTAT) = 3. 
  </code></pre>
  
  <p>In theory, we should account for overlapping occurrences of Pattern in Text right? So one way to do it is to screen down from first element to the length of text-length of the pattern we are looking for? </p>
  
  <p>Here's the pseudo code i come up with, </p>
  
  <pre><code>def PatternCount(Text, Pattern):
      count = 0
      for i = 0 to len(Text)-len(Pattern):
          if Text(i, len(Pattern)) = Pattern:
              count = count + 1
      return count
  </code></pre>
  
  <p>Any suggestion? I'm new to python. Thanks in advance. </p>