Skip to content
Advertisement

Trying to get ORF’s from a given DNA sequence

I am trying to get a printed output which would be everything from the beginning of the string, to the end, which is until it reaches a certain series of characters like “TAA”, “TAG”, or “TGA”. I can’t get it to work and was wondering if anyone here can help me??

JavaScript

Advertisement

Answer

This works although I am not sure whether you want to return something if the case 'ATG' is found, it is good practice that if one of your returns in a function returns something, then they all should even if it is None:

JavaScript

With argument = 'ATGTGAA':

JavaScript

With argument = 'GATGTGAA':

JavaScript

The docstring for functions is with """Text.""" rather then single quotes too so I changed that.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement