Files
wehub-resource-sync dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 11:55:53 +08:00

1.5 KiB

id, title, challengeType, dashedName
id title challengeType dashedName
6a2037a68a0bc2aef0005fff Challenge 337: Tally Counter 29 challenge-337

--description--

Given a string of tally marks, return the total count represented.

  • Each pipe "|" represents one count.
  • Every fifth mark is represented as a forward slash "/", completing a group of five ("||||/").
  • Groups are separated by a space.

--hints--

get_tally_count("||||") should return 4.

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_tally_count("||||"), 4)`)
}})

get_tally_count("||||/") should return 5.

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_tally_count("||||/"), 5)`)
}})

get_tally_count("||||/ |||") should return 8.

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_tally_count("||||/ |||"), 8)`)
}})

get_tally_count("||||/ ||||/ ||||/ ||") should return 17.

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_tally_count("||||/ ||||/ ||||/ ||"), 17)`)
}})

get_tally_count("||||/ ||||/ ||||/ ||||/ ||||/ ||||/ ||||/ ||||/ |") should return 41.

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_tally_count("||||/ ||||/ ||||/ ||||/ ||||/ ||||/ ||||/ ||||/ |"), 41)`)
}})

--seed--

--seed-contents--

def get_tally_count(s):

    return s

--solutions--

def get_tally_count(s):
    return len(s.replace(" ", ""))