BINP
  • Home
  • Bioinformatics
    • Rosalind
    • Galaxy
    • Bioinformatics Concepts
  • Biology Concepts
    • Evolution
    • Systematics
    • Molecular Biology
  • Computer Science
    • R
    • Python
    • Computer Basics
  • Research
  • Resources
  • About
  1. Stronghold
  2. Pra-1 Count Nucleotides
  • Rosalind
  • Python Village
    • Pra0 Install Python
    • Pra1 Variables And Some Arithmetic
    • Pra4 working with files
  • Stronghold
    • Pra-1 Count Nucleotides
    • Pra-2 Transcribing DNA Into RNA
    • Pra-3 The Secondary and Tertiary Structures of DNAclick to expand
    • Pra-4 Rabbit And Recurrence Relations
    • Pra-5 Computing GC Content
  1. Stronghold
  2. Pra-1 Count Nucleotides

Pra-1 Count Nucleotides

def countNucFrequency(seq):
    tmpFreDict = {"A": 0, "C": 0, "G": 0, "T": 0}
    for nuc in seq:
        tmpFreDict[nuc] += 1
    return tmpFreDict

DNAString = "AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC"
result = countNucFrequency(DNAString)
print(' '.join([str(val) for key, val in result.items()]))
20 12 17 21

© 2026 BINP

  • Content: CC BY 4.0

  • Code: MIT