Task 1 Removing words containing substrings Topics: List processing, string split, and join This task will ask the user to input a long string containing words and a short substring. From this input, generate two new strings: (1) consisting of words containing the substring; and (2) one without (W/O) words containing the substring. Task 1 should work as follows. 1. Ask the user to input a long sentence. 2. Ask the user to input a substring (see example below). 3. Print out the sentence (surrounded by single quotes) with the words containing the substring entered. 4. Print out the sentence (surrounded by single quotes) without the words containing the substring entered 5. Ask the user if they want to repeat this task; if "Y"/"y" is entered, go back to 1. Sample outputs (input in red) - Task 1 --- Type in a long sentence: This is a long sentence. Remove words containing: is With substring: 'This is' Print outputs surrounded by single quotes. W/O substring: 'a long sentence." Try again? [Y/N] y Type in a long sentence: The brown fox jumped over the log. Remove words containing: o With substring: 'brown fox over log." W/o substring: 'The jumped the Try again? [Y/N] Y Type in a long sentence: How much wood would a woodchuck chuck, if a woodchuck could chuck wood. Remove words containing: wood With substring: 'wood woodchuck woodchuck wood." W/o substring: 'How much would a chuck, if a could chuck' Try again? [Y/N] N

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Task 1
Removing words containing substrings
Topics: List processing, string split, and join
This task will ask the user to input a long string containing words and a short substring. From
this input, generate two new strings: (1) consisting of words containing the substring; and (2)
one without (W/O) words containing the substring.
Task 1 should work as follows.
1. Ask the user to input a long sentence.
2. Ask the user to input a substring (see example below).
3. Print out the sentence (surrounded by single quotes) with the words containing the
substring entered.
4. Print out the sentence (surrounded by single quotes) without the words containing the
substring entered
5. Ask the user if they want to repeat this task; if "Y"/"y" is entered, go back to 1.
Sample outputs (input in red)
Task 1 ---
Type in a long sentence: This is a long sentence.
Remove words containing: is
With substring: 'This is'
W/O substring: 'a long sentence.'
Try again? [Y/N] y
Type in a long sentence: The brown fox jumped over the log.
Remove words containing: o
With substring: 'brown fox over log.'
substring: 'The jumped the'
Print outputs surrounded by single quotes.
W/o
Try again? [Y/N] Y
Type in a long sentence: How much wood would a woodchuck chuck, if a woodchuck could chuck wood.
Remove words containing: wood
With substring: 'wood woodchuck woodchuck wood.'
W/o substring: 'How much would a chuck, if a could chuck'
Try again? [Y/N] N
Transcribed Image Text:Task 1 Removing words containing substrings Topics: List processing, string split, and join This task will ask the user to input a long string containing words and a short substring. From this input, generate two new strings: (1) consisting of words containing the substring; and (2) one without (W/O) words containing the substring. Task 1 should work as follows. 1. Ask the user to input a long sentence. 2. Ask the user to input a substring (see example below). 3. Print out the sentence (surrounded by single quotes) with the words containing the substring entered. 4. Print out the sentence (surrounded by single quotes) without the words containing the substring entered 5. Ask the user if they want to repeat this task; if "Y"/"y" is entered, go back to 1. Sample outputs (input in red) Task 1 --- Type in a long sentence: This is a long sentence. Remove words containing: is With substring: 'This is' W/O substring: 'a long sentence.' Try again? [Y/N] y Type in a long sentence: The brown fox jumped over the log. Remove words containing: o With substring: 'brown fox over log.' substring: 'The jumped the' Print outputs surrounded by single quotes. W/o Try again? [Y/N] Y Type in a long sentence: How much wood would a woodchuck chuck, if a woodchuck could chuck wood. Remove words containing: wood With substring: 'wood woodchuck woodchuck wood.' W/o substring: 'How much would a chuck, if a could chuck' Try again? [Y/N] N
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Computational Systems
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education