Baseline: tree as shared
This commit is contained in:
1679 files changed
+1024562
No files matched your search
@@ -0,0 +1,14 @@
|
||||
# origin: Programming+ exercise count-base (was translations.mojo, by course staff)
|
||||
# status: unverified; Stage 1 verifies it on the pinned compiler
|
||||
# probe: does the course's hand-written count_base compile and agree with the pseudo?
|
||||
# expect-stdout: 3
|
||||
def count_base(b: String, t: String) -> Int:
|
||||
var total = 0
|
||||
for i in range(t.count_codepoints()):
|
||||
if String(t[codepoint=i]) == b:
|
||||
total += 1
|
||||
return total
|
||||
|
||||
|
||||
def main():
|
||||
print(count_base("A", "GATTACA"))
|
||||
Reference in new issue
Block a user