Lesson 1 of 15

DNA Sequences

The Language of Life

DNA is the instruction manual for every living organism. It is written in an alphabet of just four letters, called nucleotide bases:

BaseLetterPairs with
AdenineAT
ThymineTA
GuanineGC
CytosineCG

A DNA sequence is a string over this four-letter alphabet. The human genome is roughly 3 billion of these letters.

seq = "ATCGATCGATCG"
print(len(seq))          # 12
print(seq.count("A"))    # 3

Programs like AlphaGenome read stretches of up to one million base pairs at a time and predict how those letters control which genes turn on in which tissues.

Your Task

Implement dna_length(seq) and count_base(seq, base) to start exploring DNA sequences.

Python runtime loading...
Loading...
Click "Run" to execute your code.