Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Python Write a function called howManyWordsAndSentences that takes in a string. Your function should return a dictionary where the keys are the order position

image text in transcribed

In Python

Write a function called 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

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

Principles Of Database Systems With Internet And Java Applications

Authors: Greg Riccardi

1st Edition

020161247X, 978-0201612479

More Books

Students also viewed these Databases questions

Question

hire your universitys graduates or those from your school?

Answered: 1 week ago