stop_codons = ["TGA", "TAG", "TAA"]
sequence = "ATGAAATGA"
sequence2 = "ATGAAATTA"
is_stop_codon = lambda x : any(x[i:i+3] in stop_codons for i in range(0,len(x),3))
print is_stop_codon(sequence)
print is_stop_codon(sequence2)
CAAATTGTGATTTGGCGCGCGACGGCGGCCAGCTGCCGCTGCTCGTTGTTTTTTCTGCAATGATATTTGGGACTATTACAAATCAAGATCTGCCTGTGATCAAGTGTGTTTTAATCAATCATAAGAACAATGATTCATCAGTGGGGAAATCATCATCATATCCCATGGTATCAGAATCCCCGGAAGACCTCGGGTGTGCGTTGAGACCCCAGAGCTCAGGGACAGTGTACGAAGCTGCCGCTGTGGAAGTGGATGTATCTGCTTCCATCACACTGCAAGTGCTGGTCGATGCCCCAGGGAACATTTCCTGTCTCTGGGTCTTTAAGCACAGCTCCCTGAATTGCCAGCCACATTTTGATTTACAAAACAGAGGAGTTGTTTCCATGGTCATTTTGAAAATGACAGAAACCCAAGCTGGAGAATACCTACTTTTTATTCAGAGTGAAGCTACCAATTACACAATATTGTTTACAGTGAGTATAAGAAATACCCTGCTTTACACATTAAGAAGACCTTACTTTAGAAAAATGGAAAACCAGGACGCCCTGGTCTGCATATCTGAGAGCGTTCCAGAGCCGATCGTGGAATGGGTGCTTTGCGATTCACAGGGGGAAAGCTGTAAAGAAGAAAGTCCAGCTGTTGTTAAAAAGGAGGAAAAAGTGCTTCATGAATTATTTGGGATGGACATAAGGTGCTGTGCCAGAAATGAACTGGGCAGGGAATGCACCAGGCTGTTCACAATAGATCTAAATCAAACTCCTCAGACCACATTGCCACAATTATTTCTTAAAGTAGGGGAACCCTTATGGATAAGGTGCAAAGCTGTTCATGTGAACCATGGATTCGGGCTCACCTGGGAATTAGAAAACAAAGCACTCGAGGAGGGCAACTACTTTGAGATGAGTACCTATTCAACAAACAGAACTATGATACGGATTCTGTTTGCTTTTGTATCATCAGTGGCAAGAAACGACACCGGATACTACACTTGTTCCTCTTCAAAGCATCCCAGTCAATCAGCTTTGGGTACCATCGTAGAAAAGGGATTTATAAATGCTACCAATTCAGTGAAGATTATGAAATGACAATATGAAAAGTTGTTTTCTTCAGGTTAAGCCTCCACCAACTAGATGTACGTGGACCTCTCCCGAATCATTTCTTGTGAGCAAAAGGTTGTTTCGGGT