Question: Write a function called in python howManyWordsAndSentences that takes in a string. Your function should return a dictionary where the keys are the order position
Write a function called in python howManyWordsAndSentences that takes in a string.
Your function should return a dictionary where the keys are the order position of each
SENTENCE (you may assume sentences will end with periods, exclamation points, or question
marks). The data for each key should be a tuple containing the number of words in the sentence
and a string containing the sentence itself (you should remove the extra spaces before or after
each sentence).
Your function should print out how many sentences there are in the input string.
Ex: For the input string
Our class string is I Love Chocolate Milk. This may seem silly. But I really do love chocolate
milk!
Your dictionary would have 3 entries
The first key would be 1, and the data would be 8 (number of words) and the string Our class
string is I Love Chocolate Milk. The second key would be 2, and that data would be 4 (number
of words) and the string This may seem silly. The third key would be 3, and the data would be
7 (number of words) and the string But I really do love chocolate milk!
Important to not use any outside packages
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
