RNA to Proteins

In biology, an RNA strand is read in groups of three characters called codons. The function proteins receives a string strand, splits it into codons of 3 characters, and translates each codon into a protein name. If a STOP codon appears, stop the translation immediately.

Примеры

Ввод
"AUG"
Вывод
["Methionine"]
Ввод
"UUUUUC"
Вывод
["Phenylalanine", "Phenylalanine"]
Ввод
"UGGUGUUAUUAA"
Вывод
["Tryptophan", "Cysteine", "Tyrosine"]

Нужно реализовать

def proteins(strand: str) -> list[str]:

Теги

stringsdictlists
PostgreSQLv16

Aquí aparecerá el resultado de la ejecución del código

Visible tests
1
Input
"AUG"
Expected["Methionine"]
2
Input
"UUUUUC"
Expected["Phenylalanine","Phenylalanine"]
3
Input
"UGGUGUUAUUAA"
Expected["Tryptophan","Cysteine","Tyrosine"]
4
Input
"UAG"
Expected[]
5
Input
"AUGUUUUGG"
Expected["Methionine","Phenylalanine","Tryptophan"]
6
Input
"AUGUUUUAA"
Expected["Methionine","Phenylalanine"]
Focus radio
Paused · SomaFM · Fluid