The question ask to find a “hidden message” in the replication origin.
Input: A string Text (representing the replication origin of a genome).
Output: A hidden message in Text.
Translate to computational language,
Input: Strings Text and Pattern.
Output: Count(Text, Pattern).
For example,
Count(ACAACTATGCATACTATCGGGAACTATCCT, ACTAT) = 3.
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?
Here's the pseudo code i come up with,
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
Any suggestion? I'm new to python. Thanks in advance.