Given this long string s:
ACAAGATGCCATTGTCCCCCGGCCTCCTGCTGCTGCTGCTCTCCGGGGCCACGGCCACCGCTGCCCTGCCCCTGGAGGGTGGCCCCACCGGCCGAGACAGCGAGCATATGCAGGAAGCGGCAGGAATAAGGAAAAGCAGCCTCCTGACTTTCCTCGCTTGGTGGTTTGAGTGGACCTCCCAGGCCAGTGCCGGGCCCCTCATAGGAGAGGAAGCTCGGGAGGTGGCCAGGCGGCAGGAAGGCGCACCCCCCCAGCAATCCGCGCGCCGGGACAGAATGCCCTGCAGGAACTTCTTCTGGAAGACCTTCTCCTCCTGCAAATAAAACCTCACCCATGAATGCTCACGCAAGTTTAATTACAGACCTGAA
I'm trying to find every occurence of the characters "ATG" and to print the index of the character that comes after every occurence of this combination.
I have already tried looping through the string, and have so far only been successful after finding the first occurrence of the characters "ATG" and to print out the index of the character after that, which is 8. My program however stops after this even though there are more occurrences of the characters "ATG" in the string.
for y in range(len(s)):
y = s[i : i + 3]
i = i + 3
if y == 'ATG':
print(s.index(y)+3)
In this part of the code 's' is the string. The result is 8 as it finds the first occurance of "ATG" and prints out the index of the character after that. My expected result should be 8, 110, 278, 336 and 340. It would seem the loop stops after finding "ATG" for the first time instead of going all the way through the string until it ends.