creating codon lists of a DNA sequence would need you to write methods in a class to generate the output in a list of triplets. However, with python, one can perform such a process in a single line of code. below is the syntax for codon lists.
>>> user_input = input("please enter your DNA sequence below: \n") # this asks the user to enter data. an example is shown below
please enter your DNA sequence below:
AAATCGGGGATGCCCGGGATTTAAGGGCGA
>>> codons = ([user_input[start:start+3]for start in range(0,len(user_input),3)])
>>> print(codons)
['AAA', 'TCG', 'GGG', 'ATG', 'CCC', 'GGG', 'ATT', 'TAA', 'GGG', 'CGA']
>>> user_input = input("please enter your DNA sequence below: \n") # this asks the user to enter data. an example is shown below
please enter your DNA sequence below:
AAATCGGGGATGCCCGGGATTTAAGGGCGA
>>> codons = ([user_input[start:start+3]for start in range(0,len(user_input),3)])
>>> print(codons)
['AAA', 'TCG', 'GGG', 'ATG', 'CCC', 'GGG', 'ATT', 'TAA', 'GGG', 'CGA']
No comments:
Post a Comment