Welcome to Project Lovelace! We're still in early development so there are still tons of bugs to find and improvements to make. If you have any suggestions, complaints, or comments please let us know on Discourse, Discord, or GitHub!

RNA translation

You will learn about: more genetics and strings.

You might want to solve DNA transcription first to learn how to transcribe DNA into RNA.


Once DNA has been transcribed into RNA, the RNA is translated into a sequence of amino acids that can then fold into a protein. The genetic code describes how RNA is translated into amino acids. Translation happens one codon at a time where each codon consists of three nucleotides, such as GUA or ACG, and gets translated into one amino acid.


The genetic code organized in a wheel showing each combination of three nucleotides or codon and the amino acid it translates to. For example, the GCA codon translate to the Ala (Alanine) amino acid.

Write some code to translate an RNA sequence into a sequence of amino acids. If you encounter a stop codon, then stop translation and return the amino acid sequence up until the stop codon (but not including it).

Input: An RNA sequence.

Output: A sequence of amino acids.

Example 1 (one codon)

Input: CCU
Output: Pro

Example 2 (stop codon at the end)

Input: AUGCCAAAGGGUUGA
Output: "MetProLysGly"

Example 3 (no stop codons)

Input: GCAAGAGAUAAUUGU
Output: AlaArgAspAsnCys
 Difficulty  Timesink
 Function amino_acid_sequence(rna)

You must be logged in to view your submissions.

Let us know what you think about this problem! Was it too hard? Difficult to understand? Also feel free to discuss the problem, ask questions, and post cool stuff on Discourse. You should be able see a discussion thread below. Would be nice if you don't post solutions in there but if you do then please organize and document your code well so others can learn from it.