Baseline: tree as shared
This commit is contained in:
commit
659c03bbf8
1471 files changed
+990535
No files matched your search
@@ -0,0 +1,17 @@
|
||||
# Generated by Programming+ from pseudo. Not reviewed for Mojo best practices.
|
||||
|
||||
# How many times each base appears in T.
|
||||
def tally_bases(t: String) raises -> Dict[String, Int]:
|
||||
var tally = Dict[String, Int]()
|
||||
var b: String
|
||||
for i in range(t.count_codepoints()):
|
||||
b = String(t[codepoint=i])
|
||||
if b in tally:
|
||||
tally[b] = tally[b] + 1
|
||||
else:
|
||||
tally[b] = 1 # first sighting of this base
|
||||
return tally.copy()
|
||||
|
||||
|
||||
def main() raises:
|
||||
print(tally_bases("GATTACA"))
|
||||
Reference in new issue
Block a user