Your question is Find Word Occurrence Count. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Motional software may need lightweight text statistics when inspecting diagnostic messages. Given a sentence, count how many times each word appears.
A word is a maximal contiguous sequence of ASCII letters or digits. Matching is case-insensitive, and punctuation separates words but is not included in the result. Return a dictionary mapping each normalized lowercase word to its occurrence count. The order of dictionary entries does not matter.
Implement count_word_occurrences(sentence), where sentence is a string. Return a dictionary whose keys are lowercase words and whose values are positive integer counts. If the sentence contains no words, return an empty dictionary.
def count_word_occurrences(sentence):