17Word Frequency
Mediumdictionariesstrings
Write word_counts(text) that returns a dictionary mapping each word to the number of times it appears.
Treat words case-insensitively (store them in lower case) and ignore the punctuation marks .,!? stuck to them.
Examples
Example 1
>>> word_counts('the cat and the hat') {'the': 2, 'cat': 1, 'and': 1, 'hat': 1}
Example 2
>>> word_counts('Hello, hello! HELLO?') {'hello': 3}
Run examples checks the 2 examples above. Submit runs all 5 tests, including hidden edge cases, and marks the challenge solved.