-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPatternMatching
More file actions
19 lines (13 loc) · 773 Bytes
/
PatternMatching
File metadata and controls
19 lines (13 loc) · 773 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Copy your PatternMatching function below this line.
# The following lines will automatically read in the Vibrio cholerae genome for you and store it in a variable named v_cholerae
import sys # needed to read the genome
input = sys.stdin.read().splitlines() #
v_cholerae = input[1] # store the genome as 'v_cholerae'
# Call PatternMatching with Pattern equal to "CTTGATCAT" and Genome equal to v_cholerae,
def PatternMatching(Pattern, Genome):
return [i for i in range(len(Genome)-len(Pattern)+1) if Pattern == Genome[i:i+len(Pattern)]]
Genome = v_cholerae
Pattern = 'CTTGATCAT'
# and store the output as a variable called positions
# print the positions variable
print (( PatternMatching(Pattern,Genome)))