In this exercise you will create a program that identifies all of the words in a...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 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
Expert Answer:
Related Book For
Microsoft Visual C# An Introduction to Object-Oriented Programming
ISBN: 978-1337102100
7th edition
Authors: Joyce Farrell
Posted Date:
Students also viewed these programming questions
-
Must be completed in PYTHON only
-
Must be completed in Python only Question 3: [Dictionary: Text Messaging] On some basic cell phones, text messages can be sent using the numeric keypad. Because each key has multiple letters...
-
Must be completed in PYTHON only Question 5: [File: Spell Checker] A spell checker can be a helpful tool for people who struggle to spell words correctly. In this exercise, you will write a program...
-
Explain how you solve problems during the implementation of your projects. Does this operate as a formal approach and/or use specific supportive techniques?
-
Air at 200 kPa is compressed in the insulated cylinder of Fig. 3.53 with an initial volume of 4000 cm3. What is the work required if the final volume is a) 1000 cm3, b) 600 cm3, c) 400 cm3 ? Assume...
-
1. What developmental needs does Phil Baxter appear to have? 2. If you were Marge Caitlin, what would you recommend that Baxter do? 3. From the little evidence that you have, what is your opinion of...
-
What is the internal rate of return of the following cash flow diagram? a. 20 percent b. 18.2 percent c. 17.5 percent d. 15 percent $30 $31 0 1 2 3 $30 $15
-
The owner of the Chocolate Outlet Store wants to forecast chocolate demand. Demand for the preceding four years is shown in the following table: YEAR DEMAND (POUNDS) 1 .......... 68,800 2 .............
-
1)Consider the crowding out model. Assume there are men and women in the labor force and three occupations: preschool, elementary and secondary teachers. Suppose only women can work as elementary and...
-
1. Determinewhether differences exist in the relationship status and the self rated fitness based on the product purchased ( TM195, TM498, TM798). 2. Write a report to be presented to the management...
-
You anticipate that a mature company will only be able to pay its current dividend of $4 for 10 more years. If your required return for this company is 8%, what is the value of the stock today? l.
-
A company is trying to estimate the first-year cash flow (at Year 1) for a proposed project. The financial staff has collected the following information on the project: Sales Optg costs (Excluding...
-
The company you work for is considering a project that has the following cash flows: Yr. 0: -720,000 Yr. 1: 328,000 Yr. 2: 382,000 Yr. 3: -127,000 Yr. 4: 295,000 Yr. 5: 320,000 Please compute the...
-
Your coin collection contains 44 silver dollars minted in 1950. If your grandparents purchased them for their face value when they were new, how much will your collection be worth when you retire in...
-
In its IPO, 1 million company shares were issued at a price of $28 per share. The underwriter's fee for the offering was 10% of gross proceeds and the issuer incurred direct out-of-pocket costs of...
-
LaMont and Sons is considering the purchase of some wood lathes for $229,001. These lathes belong in a 30% CCA class. The firm expects that it will be able to sell the machines for $49,500 in four...
-
COMPLETE BUDGETS AND A CVP ANALYSIS FOR CARA'S PARTY EMPORIUM In this exercise, you will create budgets and perform CVP analyses for Cara's Party Emporium. You will first create a cash budget,...
-
A red card is illuminated by red light. What color will the card appear? What if its illuminated by blue light?
-
In this exercise, you modify the program from Computer Exercise 23. If necessary, create a new project named Intermediate24 Project and save it in the Cpp8\Chap12 folder. Copy the instructions from...
-
A local department store is having a BoGoHo (Buy One, Get One Half Off) sale. The store manager wants a program that allows the salesclerk to enter the prices of two items. The program should...
-
The C++ code in Figure 6-39 should display one of the four messages listed in the figure. The appropriate message is based on the level entered by the user. Correct the errors in the code. Level 1 or...
-
Rewrite the Gross-Pitaevskii equation and the mean field energy, see equations (11.2.21) and (11.2.23), for an isotropic harmonic oscillator trap with frequency \(\omega_{0}\) in a dimensionless form...
-
The energy levels of an imperfect Fermi gas in the presence of an external magnetic field \(\boldsymbol{H}\), to the first order in \(a\), may be written as...
-
Solve the Gross-Pitaevskii equation (11.2.23) in a harmonic trap for the case when the scattering length \(a\) is zero. Show that this reproduces the properties of the ground state of the...
Study smarter with the SolutionInn App