ubuntu2004
Kernel: Python 3 (system-wide)
Exercise 13.1
Loop through the following DNA sequences. Stop when you find the first sequence starting with "TATA" and print that sequence.
Hint 1:
break
out of the loop.Hint 2: Use string slicing to access the first four bases of each DNA sequence.
In [5]:
Out[5]:
TATATCGCTAGGGTATAGGGTT
Exercise 13.2
Count how many of the three stop codons "TAA", "TAG" and "TGA" occur in each of the following DNA sequences in the list dna_sequences
. Ignore multiple occurrences of the same stop codon in a DNA sequence.
Hint: You will need a nested loop: An outer loop to go through the sequences and a nested loop to go through the stop codons.
In [36]:
Out[36]:
TAA not present
TAG is present
TGA is present
2 stop codons are present in TATCATGGTATAGGATGAT
TAA not present
TAG is present
TGA not present
1 stop codons are present in CTATAGCCTATATATTAGGA
TAA not present
TAG is present
TGA not present
1 stop codons are present in TATATCGCTAGGGTATAGGGTT
TAA not present
TAG is present
TGA is present
2 stop codons are present in TATGAGGATTAGA
TAA not present
TAG is present
TGA not present
1 stop codons are present in TATAGACTAGGAT