python: def dna_slice(strand, first_nucleotides, last_nucleotides): """ Question 3 - Regex You are working with a long strand of DNA. Your task is to find and return the length of the first substrand that begins with the two-letter sequence specified in first_nucleotides and ends with the sequence specified in last_nucleotides. THIS MUST BE DONE IN ONE LINE. Args: strand (str) first_nucleotides (str) last_nucleotides (str) Returns: int strand_1 = 'TATGGGTCGAGCATGT' >>> dna_slice(strand_1, 'AT', 'CG') 8 >>> dna_slice(strand_1, 'GT', 'TG') 10 """ strand_1 = 'TATGGGTCGAGCATGT' pprint(dna_slice(strand_1, 'AT', 'CG')) pprint(dna_slice(strand_1, 'GT', 'TG'))
python:
def dna_slice(strand, first_nucleotides, last_nucleotides):
"""
Question 3 - Regex
You are working with a long strand of DNA. Your task is to find and return the length of the first substrand
that begins with the two-letter sequence specified in first_nucleotides and ends with the sequence specified in last_nucleotides.
THIS MUST BE DONE IN ONE LINE.
Args:
strand (str)
first_nucleotides (str)
last_nucleotides (str)
Returns:
int
strand_1 = 'TATGGGTCGAGCATGT'
>>> dna_slice(strand_1, 'AT', 'CG')
8
>>> dna_slice(strand_1, 'GT', 'TG')
10
"""
strand_1 = 'TATGGGTCGAGCATGT'
pprint(dna_slice(strand_1, 'AT', 'CG'))
pprint(dna_slice(strand_1, 'GT', 'TG'))
Step by step
Solved in 3 steps with 1 images