Solve a few problems

This commit is contained in:
Alberto Venturini 2024-09-01 17:02:41 +02:00
commit 59de67963d
14 changed files with 101 additions and 0 deletions

11
01_dna/dna.nim Normal file
View file

@ -0,0 +1,11 @@
import std/strformat
import std/tables
var baseCounts = {'A': 0, 'C': 0, 'G': 0, 'T': 0}.toTable
var dnaString = readFile("rosalind_dna.txt")
for c in items(dnaString):
if c in baseCounts:
inc(baseCounts[c])
echo fmt"{baseCounts['A']} {baseCounts['C']} {baseCounts['G']} {baseCounts['T']}"