Question: Exercise 5: Mapping a String of Triplets to Codons Compose a function rna2codons which accepts a string of three-letter codons triplets and returns a string

Exercise 5: Mapping a String of Triplets to Codons Compose a function rna2codons which accepts a string of three-letter codons triplets and returns a string amino representing the set of corresponding amino acids per the table above. That is, the input 'GAUUAUUCC' should return 'DYS'. The function should convert any input into upper-case and should check that each codon is valid. The tricky part is figuring out how to get a string chopped into three-letter chunks. (This is harder than it seems at first.) There are many ways you can think of to do this. One possibility: example_string = 'abcdefghijklmnopqrstuvwxyz' for i in range( 0, int( len( example_string ) / 3)): print( example_string[ 3*1:3*i+3 ] ) #grade def rna2codons (triplets): Exercise 5: Mapping a String of Triplets to Codons Compose a function rna2codons which accepts a string of three-letter codons triplets and returns a string amino representing the set of corresponding amino acids per the table above. That is, the input 'GAUUAUUCC' should return 'DYS'. The function should convert any input into upper-case and should check that each codon is valid. The tricky part is figuring out how to get a string chopped into three-letter chunks. (This is harder than it seems at first.) There are many ways you can think of to do this. One possibility: example_string = 'abcdefghijklmnopqrstuvwxyz' for i in range( 0, int( len( example_string ) / 3)): print( example_string[ 3*1:3*i+3 ] ) #grade def rna2codons (triplets)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
