Horje
The function to be built, amino_acids, must return a list of a tuple and an integer when given a string of mRNA code. Code Example
The function to be built, amino_acids, must return a list of a tuple and an integer when given a string of mRNA code.
def amino_acids(mrna):
    protein = ""  # Start with empty protein string
    translation = {"AUG": "Met", "CCA": "Pro", "CCU": "Pro"}  # Which codon translates for which amino acid
    stop_codons = {"UGA"}  # Define stop codons
    while mrna:  # Repeat loop while mRNA isn't exhausted
        codon = mrna[:3]  # Select first three codes
        mrna = mrna[3:]  # Remove current codon from mRNA
        if codon in stop_codons:
            break  # Break loop if triple is a stop codon
        amino_acid = translation[codon]  # Translate codon into its amino acid
        protein += amino_acid  # Add the amino acid to the protein string
    return protein

print(amino_acids("AUGCCACCUUGA"))




Python

Related
how to get the remainder of a number when dividing in python Code Example how to get the remainder of a number when dividing in python Code Example
python print statements Code Example python print statements Code Example
for j in range python Code Example for j in range python Code Example
python seaborn violin stack overflow Code Example python seaborn violin stack overflow Code Example
django nested inlines Code Example django nested inlines Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
10