Question: Problem 4 Define a function called count_words(s) that satisfies the following criteria: - Counts the occurences of unique words in a string s and returns

Problem 4 Define a function called count_words(s) that satisfies the following criteria: - Counts the occurences of unique words in a string s and returns the result as a dictionary - Word uniqueness should not consider case or any non-alphanumeric characters Hint: You may find it helpful to write a separate helper function that builds a dictionary of unique values and their counts. Examples: In : count_words("I am that I am. ") Out: {i:2, 'am': , 'that': 1\} In : count_words("We are not who we are.") Out: \{'we': 2, 'are': 2, 'not': 1, 'who': 1}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
