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
79 lines
1.5 KiB
Markdown
79 lines
1.5 KiB
Markdown
---
|
|
id: 6a2037a68a0bc2aef0005fff
|
|
title: "Challenge 337: Tally Counter"
|
|
challengeType: 29
|
|
dashedName: 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`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(get_tally_count("||||"), 4)`)
|
|
}})
|
|
```
|
|
|
|
`get_tally_count("||||/")` should return `5`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(get_tally_count("||||/"), 5)`)
|
|
}})
|
|
```
|
|
|
|
`get_tally_count("||||/ |||")` should return `8`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(get_tally_count("||||/ |||"), 8)`)
|
|
}})
|
|
```
|
|
|
|
`get_tally_count("||||/ ||||/ ||||/ ||")` should return `17`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(get_tally_count("||||/ ||||/ ||||/ ||"), 17)`)
|
|
}})
|
|
```
|
|
|
|
`get_tally_count("||||/ ||||/ ||||/ ||||/ ||||/ ||||/ ||||/ ||||/ |")` should return `41`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(get_tally_count("||||/ ||||/ ||||/ ||||/ ||||/ ||||/ ||||/ ||||/ |"), 41)`)
|
|
}})
|
|
```
|
|
|
|
# --seed--
|
|
|
|
## --seed-contents--
|
|
|
|
```py
|
|
def get_tally_count(s):
|
|
|
|
return s
|
|
```
|
|
|
|
# --solutions--
|
|
|
|
```py
|
|
def get_tally_count(s):
|
|
return len(s.replace(" ", ""))
|
|
```
|