Question: In this exercise you will create a program that identifies all of the words in a string entered by the user. Begin by writing
In this exercise you will create a program that identifies all of the words in a string entered by the user. Begin by writing a function that takes a string of text as its only parameter. Your function should return a list of the words in the string with the punctu- ation marks at the edges of the words removed. The punctuation marks that you must remove include commas, periods, question marks, hyphens, apostrophes, exclama- tion points, colons, and semicolons. Do not remove punctuation marks that appear in the middle of a words, such as the apostrophes used to form a contraction. For exam- ple, if your function is provided with the string "Examples of contractions include: don't, isn't, and wouldn't." then your function should return the list ["Examples", "don't", "isn't", "and", "wouldn't"]. "of", "contractions", "include", Write a main program that demonstrates your function. It should read a string from the user and display all of the words in the string with the punctuation marks removed. You will need to import your solution to this exercise when completing Exercise 158. As a result, you should ensure that your main program only runs when your file has not been imported into another program. Must be completed in python only
Step by Step Solution
3.33 Rating (156 Votes )
There are 3 Steps involved in it
To solve this problem in Python you need to create a function that processes a string by removing specific punctuation from the edges of words and the... View full answer
Get step-by-step solutions from verified subject matter experts
