This week you will write a program that will replace the first and last word in a given sentence. First, your program should ask the user to input a sentence. Next your program should ask the user for the word to replace the first word with. Then your program should also ask for the word. to replace the last word with. Finally, your program should display the new sentence with the new first and last words.

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
Problem Description:
This week you will write a program that will replace the first and last word in a given sentence.
First, your program should ask the user to input a sentence. Next your program should ask the
user for the word to replace the first word with. Then your program should also ask for the word
to replace the last word with. Finally, your program should display the new sentence with the
new first and last words.
You are required to use slices for this task. Failure to use slices will result in a grade of zero-
no exceptions. Use of split or replace (both of which have not been covered) or any other
method not covered by the instructor will result in no credit for the assignment.
Your code must work with ANY sentence I enter in to earn credit.
In order to earn full credit on the assignment:
Provide a course comment header with your name, date, and assignment name.
Separate sections of code with a blank line (i.e. write the input section, separate with a blank
line, write the processing section, blank line, write the output section, etc.). If I see a wall of
code with no logical sections, credit will be lost.
D
Provide comments throughout your code. The assignment is tricky so you will want those
comments to keep track of what you're doing and why!
Getting Started:
Remember the data processing cycle we discussed in class. Answer the following questions:
1. What information do I need in order to solve this problem?
2. What processing/ calculations do I need to do in order to find the answer?
3. What are the output(s)/ answer(s) for the given problem?
Transcribed Image Text:Problem Description: This week you will write a program that will replace the first and last word in a given sentence. First, your program should ask the user to input a sentence. Next your program should ask the user for the word to replace the first word with. Then your program should also ask for the word to replace the last word with. Finally, your program should display the new sentence with the new first and last words. You are required to use slices for this task. Failure to use slices will result in a grade of zero- no exceptions. Use of split or replace (both of which have not been covered) or any other method not covered by the instructor will result in no credit for the assignment. Your code must work with ANY sentence I enter in to earn credit. In order to earn full credit on the assignment: Provide a course comment header with your name, date, and assignment name. Separate sections of code with a blank line (i.e. write the input section, separate with a blank line, write the processing section, blank line, write the output section, etc.). If I see a wall of code with no logical sections, credit will be lost. D Provide comments throughout your code. The assignment is tricky so you will want those comments to keep track of what you're doing and why! Getting Started: Remember the data processing cycle we discussed in class. Answer the following questions: 1. What information do I need in order to solve this problem? 2. What processing/ calculations do I need to do in order to find the answer? 3. What are the output(s)/ answer(s) for the given problem?
Examples of Problem:
Here are examples of this problem being solved in action. Recall that when we work on
solutions to problems, it is much like a conversation. In order to help me, you must ask me for
any relevant information, process the data I give you, and then provide me with an answer.
In the provided examples, the values in blue are examples of what your part of the conversation
might look like. The values in black are examples of what I might say to you in this exchange.
Enter the initial phrase: Trick or treat, smell my feet!
Enter the new first word: Artifice
Enter the new last word: tootsies
New Phrase: Artifice or treat, smell my tootsies!
Here is another example:
Enter the initial phrase: Is this hard?
Enter the new first word: Was
Enter the new last word: simple
New Phrase: Was this simple?
Transcribed Image Text:Examples of Problem: Here are examples of this problem being solved in action. Recall that when we work on solutions to problems, it is much like a conversation. In order to help me, you must ask me for any relevant information, process the data I give you, and then provide me with an answer. In the provided examples, the values in blue are examples of what your part of the conversation might look like. The values in black are examples of what I might say to you in this exchange. Enter the initial phrase: Trick or treat, smell my feet! Enter the new first word: Artifice Enter the new last word: tootsies New Phrase: Artifice or treat, smell my tootsies! Here is another example: Enter the initial phrase: Is this hard? Enter the new first word: Was Enter the new last word: simple New Phrase: Was this simple?
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Program on Numbers
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