I have these two strings:
t = 'GATATCATGCATATACTT'
s = 'ATAT'
I am trying to create a function that returns in a list the positions where the reason for the string s was found in the sequence of the string t. That is, in this case, the positions would be [1, 10]. But also, if the reason is not found, the list will return [-1].
def search_motif (t, s):
search_motif = list()
for i, x in enumerate(t):
if s in x:
search_motif.append(i)
i + = 1
return [-1] # this must go to the end
print (search_motif (t, s))
Am I going the right way? Can someone please guide me?