Question: Dictionaries are particularly useful for considering items which arent ordered. Write a function called countWords which accepts a single string argument s which will be
Dictionaries are particularly useful for considering items which arent ordered.
Write a function called countWords which accepts a single string argument s which will be a large sentence. Your function is required to return a dictionary of the form {word, count} counting the number of times each distinct word occured in input s.
Enter your answer in curly brackets. For example if the input is hello there hello, your answer could be {hello:2,there:1} without any spaces.
What is your answer for the following inputs:
A. 'the the the the the' =
B. '' (empty string) =
C. 'the quick fox quick the' =
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
