so i am trying to write a code that takes is a function for defining Amino Acids. This function takes in a sequence and translates it into mRNA (DNA= ATCGATCG, mRNA= AUCGAUCG) i have no problem with this. The one problem I am having seems like the simplest part of the whole thing. taking in the mRNA and looping throw it 3 characters at a time (AUC, GAU) and disregards any remanding characters. Any help would be appreciated seeing how I have already pulled out everything in my tiny CS1 arsenal.

Use a for() loop with step=3.

for ctr in range(0, len(DNA), 3):
    print DNA[ctr:ctr+3]
def numberOfTimes(sequence, nucleotide):
        count= 0
        for char in sequence:
                if char == nucleotide:
                        count += 1
        return count

def generateSecondStrand(sequence):
        newStrand= ""
        for char in sequence:
                if char == "A":
                        newChar= "T"
                if char == "T":
                        newChar= "A"
                if char == "C":
                        newChar= "G"
                if char == "G":
                        newChar= "C"
                newStrand= newStrand + newChar
        return newStrand

def generatemRNASequence(sequence):
        sequence= generateSecondStrand(sequence)
        mRNA= ""
        for char in sequence:
                if char == "T":
                        char= "U"
                mRNA= mRNA + char
        return mRNA

def generateAnAminoAcidSequence(sequence):
        sequence= generatemRNASequence(sequence)

        subString= ""

        for seq in range(0, len(sequence), 3):
           if seq< len(sequence):
                   seq= aminoAcidTranslation(seq)
                   subString= subString + seq
        return subString

def aminoAcidTranslation(seq):
   translator = { "GCA":"A", "GCC":"A", "GCG":"A", "GCU":"A",
                        "AGA":"R", "AGG":"R", "CGA":"R", "CGC":"R", "CGG":"R", "CGU":"R",
                        "GAC":"D", "GAU":"D",
                        "AAC":"A", "AAU":"A",
                        "UGC":"C", "UGU":"C",
                        "GAA":"E", "GAG":"E",
                        "CAA":"Q", "CAG":"Q",
                        "GGA":"G", "GGC":"G", "GGU":"G", "GGG":"G",
                        "CAC":"H", "CAU":"H",
                        "AUA":"I", "AUC":"I", "AUU":"I", 
                        "UUA":"L", "UUG":"L", "CUA":"L", "CUC":"L", "CUG":"L", "CUU":"L",
                        "AAA":"K", "AAG":"K",
                        "UUC":"F", "UUU":"F",
                        "CCA":"P", "CCC":"P", "CCG":"P", "CCU":"P",
                        "AGC":"S", "AGU":"S", "UCA":"S", "UCC":"S", "UCG":"S", "UCU":"S",
                        "ACA":"T", "ACC":"T", "ACG":"T", "ACU":"T",
                        "UAC":"Y", "UAU":"Y",
                        "GUA":"V", "GUC":"V", "GUG":"V", "GUU":"V",
                        "UAA":"*", "UAG":"*", "UGA":"*" }
   if translator.has_key(seq):
      return translator[seq]
      return "?"]

problem I am having is in the generateAnAminoAcidSequence.

the purpose of this function is to tear down the mRNA into 3 character parts and matching it up with the amino acid in the last function. However the way I have it written it returns 0, 3, 6. I can't figure out how to break it down into characters and not the index. I hope any of this makes sense... Oh so frustrating.

i apologize this is my first time posting code into a forum, wasn't sure how to format it... my bad.