Pybites Logo

Gc content

Level: Beginner (score: 2)

The DNA of all organsims consists of the letters (bases) A, C, T and G. Every organism has a different ratio of these bases, known as the GC content. This information can not only give clues about the origin of genetic material but can also help to determine how closely related some organisms are.

For the given DNA sequences calculate the GC content as a percentage of all (allowed) bases (=percentage of the letters G or C).

Example:
DNA Sequence:
AAAAAAAATTTTTTGGGGCC
A=8, T=6, G=4, C=2, TOTAL = 20
GC content = n(G|C) / n(A|C|G|T) = 6/20 = 3/10 => 30%

For more background info on DNA check out this link.

Hint: always read the test cases carefully! 📖