Dictionaries · routine
Count the words
Write word_count(text) returning a dictionary from each word (split on spaces) to how many times it appears: "a b a" gives {"a": 2, "b": 1}.
- right answers
- arguments left as they should be
- without Counter, collections
Run adds print(word_count("a b a")) after your code, to try it.
Stuck on the idea rather than the code? The Dictionaries lesson walks through it.