Created
February 12, 2014 02:48
-
-
Save szeitlin/8949129 to your computer and use it in GitHub Desktop.
Rosalind problem 1 solution.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Rosalind problem 1 | |
def ACGT_count(sequence): | |
''' | |
(str) -> (int, int, int, int) | |
Count the number of A, C, G and T in a string. | |
>>>ACGT_count('ATGCTTCAGAAAGGTCTTACG') | |
6 4 5 1 | |
''' | |
A=0 | |
C=0 | |
G=0 | |
T=0 | |
for char in sequence: | |
if char == "A": | |
A = A + 1 | |
elif char == 'C': | |
C = C + 1 | |
elif char == 'G': | |
G = G + 1 | |
elif char == 'T': | |
T = T + 1 | |
else: | |
print('not a nucleotide') | |
print(A, C, G, T) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment