839 B
839 B
type, title, xp, duration, difficulty
| type | title | xp | duration | difficulty |
|---|---|---|---|---|
| challenge | The Counter | 75 | 30 | 3 |
The Counter
[INCOMING — Mission Control, Earth]
Cadet, time to count things in text. Three counts:
- Total length —
len(s)- Word count —
len(s.split())(split breaks on whitespace)acount —s.lower().count("a")returns how manyasImplement
count(s)that returns a dict with three keys:
length— total chars including spaceswords— word counta_count— number of lowercaseas after lowercasing[END TRANSMISSION]
Your Task
In starter/starter.py, build the dict using len(), .split(),
.lower(), .count().
Objectives
count("Hello andromeda")→{"length": 15, "words": 2, "a_count": 2}- All three keys present and correct for any sentence