Baseline: tree as shared

This commit is contained in:
alexm committed 2026-10-05 03:03:38 +00:00
commit 659c03bbf8
1471 files changed
+990535

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
# origin: Programming+ exercise tally
# status: unverified; `corpus.py verify` checks it on the pinned compiler
# probe: how many times each base appears in t, in a Dict
# expect-stdout: {G: 1, A: 3, T: 2, C: 1}
def tally_bases(t: String) raises -> Dict[String, Int]:
var tally = Dict[String, Int]()
for i in range(t.count_codepoints()):
var b = String(t[codepoint=i])
if b in tally:
tally[b] += 1
else:
tally[b] = 1
return tally^
def main() raises:
print(tally_bases("GATTACA"))