Question: I need a code to pass the given tests using the starter code Q6: Word counter (2 pts.) In this question, you'll define a custom

I need a code to pass the given tests using the starter code
Q6: Word counter (2 pts.) In this question, you'll define a custom function that will identify how many times a given word occurred in a passage of text. Define a function called count_word which: - Takes two arguments: a passage and a word. - passage is the str you're searching. - word is the word you're looking for. - return s the number of times that word appears. - Hint: You might first want to use your clean_text function before identifying all the words. Starter code: def count_word(passage, word): passage_cleaned = clean_text ( passage ) ....\#\# Write more code here! \# your code here \#\# This cell has at least one hidden test assert count_word assert count_word("short test passage is a test", "test") =2 assert count_word("short test passage is a test", "passage") == 1 \#\# This cell has at least one hidden test assert count_word("test!! but also this test and also this TEST", "test") =3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
