Python Forum

Full Version: Question #1: Count symbols
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
In this question, you are given a string s which represents a DNA string. The string s consists of symbols 'A', 'C', 'G', and 'T'. An example of a length 21 DNA string is "ATGCTTCAGAAAGGTCTTACG."
Your task is to write a code which will count the number of times each of the symbols 'A', 'C', 'G', and 'T' occur in s. Your code should generate a list of 4 integers and print it out.
In [1]:
# Here is the DNA string:
​s = 'AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC'
# Type your code here
You should try it yourself.
Counter, sorted and list comprehension is one way to go.
@apurdel: How do you get alnng ?