Task: countwords
# Task: count_words
## Deliverable
Implement `count_words(text: str) -> dict[str, int]` in `count_words.py`.
## Spec
- Split on **whitespace** (any unicode whitespace via `str.split()` with no args).
- Words are case-**folded** with `str.casefold()` for counting keys.
- Strip leading/trailing ASCII punctuation from each token using characters in
`string.punctuation` only (not mid-word hyphens: `well-known` stays one token
after edge strip — if both edges are punctuation, strip repeatedly from ends).
- Empty tokens after stripping are dropped.
- Return a dict mapping word → count. Iteration order is not graded.
- Empty input or all-punctuation/whitespace → `{}`.
- Stdlib only.
## Constraints
Starter tree only; no hidden-test edits.
## Done means
Hidden tests pass.when to use it
Community prompt sourced from the open-source GitHub repo TinkerandScribe/gxp (MIT). A "Task: countwords" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.
tags
productivitycommunitydeveloper
source
TinkerandScribe/gxp · MIT
more in Productivity
Productivity✓ tested
Summarize a doc into decisions & actions
chief of staff who extracts what to DO, not just what was said
Productivity✓ tested
Draft a reply to a hard email
calm, direct communicator who de-escalates without caving
Productivity✓ tested
Turn a brain-dump into a weekly plan
planning coach who protects your focus, not just your calendar