avatar Bite 262. GC content

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).

DNA Sequence:
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! 📖

Login and get coding
go back Beginner level
Bitecoin 2X

246 out of 246 users completed this Bite.
Will you be Pythonista #247 to crack this Bite?
Resolution time: ~36 min. (avg. submissions of 5-240 min.)
Pythonistas rate this Bite 2.44 on a 1-10 difficulty scale.
» You can do it! 😌

Focus on this Bite hiding sidebars, turn on Focus Mode.