Minsu Kim/python/Rosalind / problem9

From Biolecture.org

 

import itertools

f = open('rosalind_ba1k.txt', 'r')
lines = f.readlines()
seq = lines[0].strip()
k = int(lines[1].strip())
f.close

for i in itertools.product("ACGT", repeat=k):
    point = ''.join(i)
    count = 0
    for j in range(len(seq) - k + 1):
        if seq[j : j + k] == point:
            count += 1
    print(count)