Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Distributed Relational Database Architecture Connectivity Guide

Authors: Teresa Hopper

4th Edition

0133983064, 978-0133983067

More Books

Students also viewed these Databases questions

Question

Is my message persuasive? Motivating?

Answered: 1 week ago

Question

Where those not participating, encouraged to participate?

Answered: 1 week ago

Question

3. Who would the members be?

Answered: 1 week ago