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

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!