Given: A DNA string “s” of length at most 1000 nt.
Return: Four integers (separated by spaces) counting the respective number of times that the symbols ‘A’, ‘C’, ‘G’, and ‘T’ occur in “s”.
Example input:
AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC
Should output:
20 12 17 21
Now input:
TCCCTCGAAAACTAGAGGACGCCGTCAAAGTAAGTTGCGTTCTCGTTGACTATAGGCTGCGGTCCCGCCTTACACTGCTTTTGAACATACCTCAGAACACTCTCTATCCCTGGTGTTTACAGGTATTTCGCACGCTTTAACACTAGCCCCTTCAAAACTCCACCTGCTCTTGGATATACCGTAGATGAGACGATTGAGTTATGTTCTCAGCACAAGAGGATAGGTTTGCGAAGAGCGTGGCCTCTACCAAGACCTCGCGAAAGATAGTCGTTGAGGAATAGGTCGCTATTGTCCTGCCGAGCACGTGTAATATTTTAATCGTGGATCCGGAGTCAGACGGGACTGGTCTCTTCTATTGGCCCTCCCTGTTAGCATGCGCAAAAAGTAACGCCCTCGGCAGCGCATAGCGTGATATTGTTGTAACACTGGCTAGCGATCGCGCCATTATCCTTGGCTCAAAGTCTGTCCCTTTCAATACTTACATCAATGAGCCGACATCTAAAGATATGCCCTTGTTCCTTCCGCGTATACTTCGGCGGGGTACAACGGTGAGGCAAGGATTGTCACGCCATGGCGACCTTTGGTCCCCAGTGCAGCCGCCAATCACCTGGGACATGCCAGGAGCCAGCCTGCAGTTTGGTACCTAACCTGTAGGTAAGGGCGGCGCCCGAACCAGCCCTATCTCTGGGTACCGGAGGTTCATTTAGCACGCTAGGTTCCCGTGGAACGGTGTGGAACCCTGCTCTTCCACTGCAGTGTATGATGGTCTGTTGATTGTACCCCACCGACGCCGAAAGTGTAATAAAGCCCACGATTCGCCTGTATCAT
def count(DNA):
a_count, c_count, g_count, t_count = 0,0,0,0
for char in DNA:
if char == 'A':
a_count += 1
elif char == 'C':
c_count += 1
elif char == 'G':
g_count += 1
elif char == 'T':
t_count += 1
else:
continue
return a_count, c_count, g_count, t_count
q1_input = "TCCCTCGAAAACTAGAGGACGCCGTCAAAGTAAGTTGCGTTCTCGTTGACTATAGGCTGCGGTCCCGCCTTACACTGCTTTTGAACATACCTCAGAACACTCTCTATCCCTGGTGTTTACAGGTATTTCGCACGCTTTAACACTAGCCCCTTCAAAACTCCACCTGCTCTTGGATATACCGTAGATGAGACGATTGAGTTATGTTCTCAGCACAAGAGGATAGGTTTGCGAAGAGCGTGGCCTCTACCAAGACCTCGCGAAAGATAGTCGTTGAGGAATAGGTCGCTATTGTCCTGCCGAGCACGTGTAATATTTTAATCGTGGATCCGGAGTCAGACGGGACTGGTCTCTTCTATTGGCCCTCCCTGTTAGCATGCGCAAAAAGTAACGCCCTCGGCAGCGCATAGCGTGATATTGTTGTAACACTGGCTAGCGATCGCGCCATTATCCTTGGCTCAAAGTCTGTCCCTTTCAATACTTACATCAATGAGCCGACATCTAAAGATATGCCCTTGTTCCTTCCGCGTATACTTCGGCGGGGTACAACGGTGAGGCAAGGATTGTCACGCCATGGCGACCTTTGGTCCCCAGTGCAGCCGCCAATCACCTGGGACATGCCAGGAGCCAGCCTGCAGTTTGGTACCTAACCTGTAGGTAAGGGCGGCGCCCGAACCAGCCCTATCTCTGGGTACCGGAGGTTCATTTAGCACGCTAGGTTCCCGTGGAACGGTGTGGAACCCTGCTCTTCCACTGCAGTGTATGATGGTCTGTTGATTGTACCCCACCGACGCCGAAAGTGTAATAAAGCCCACGATTCGCCTGTATCAT"
print(count(q1_input))