Skip to content

Instantly share code, notes, and snippets.

@ychaouche
Created October 14, 2012 15:29
Show Gist options
  • Select an option

  • Save ychaouche/3888918 to your computer and use it in GitHub Desktop.

Select an option

Save ychaouche/3888918 to your computer and use it in GitHub Desktop.
lazy version of the ADN parser
def is_valid_sequence(sequence):
for character in sequence:
if character not in "ACTG":
return False
return True
@anshumanv2
Copy link

insert_sequence:
(str, str, int) -> str

The first two parameters are DNA sequences and the third parameter is an index. Return the DNA sequence obtained by inserting the second DNA sequence into the first DNA sequence at the given index. (You can assume that the index is valid.)
For example, If you call this function with arguments 'CCGG', 'AT', and 2, then it should return 'CCATGG'.
When coming up with more examples, think about where the second DNA sequence might be inserted: what are the extremes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment