пятница, 18 ноября 2016 г.

Finding a Motif in DNA (ROSALIND SUBS)

Given: Two DNA strings s and t (each of length at most 1 kbp).
Return: All locations of t as a substring of s.

s = 'TCACTCGATTGGAACCGA'
t = 'CACTCGACA'
occurence = []
start_position = 0
while True:
 start_position = s.find(t, start_position+1)
 if start_position == -1:
  break
 occurence.append(start_position+1)
res = ''
for i in occurence:
 res += str(i) + ' '
print res


Комментариев нет:

Отправить комментарий