Question: Write a function named q2() with no parameters and no return value. Inside the q2() function, you can write your own functions to accomplish

Write a function named q2() with no parameters and no return value. Inside the q2() function, you can write Input to your program from the keyboard: Hello are you lend Hello dear! How are you doing? lend Output from

Write a function named q2() with no parameters and no return value. Inside the q2() function, you can write your own functions to accomplish the following tasks: 1. Create an empty list that will be used to store words. Read each word from the input. Each word is input on a separate line. The string lend on a new line indicates the end of words. DO NOT PRINT ANYTHING YET. 2. Create another empty list that will be used to store user input, which will be in text format. Input text may contain many words; the text may be on separate input lines. The end of text is indicated by the string lend on a new line. DO NOT PRINT ANYTHING YET 3. The text in part 2) above may contain any of the following, and no other, punctuation marks: period (), comma (.), question mark (?), and exclamation point (!). Replace each punctuation mark in the text by a space. DO NOT PRINT ANYTHING YET. 4. Mutate the text you have in part 2) by replacing each word in the text by reverse but only if the word appears in the list of words input in a). For example, reverse of "Hello" is "olleH". 5. Print the mutated text. Hints: Use the string replace() function to remove punctuation marks and lend from the text. Use the string remove() function to remove the string lend from the list of words. Use string slicing to obtain a reverse of a word. Test your program using the following test case, and many more that you may construct yourself. Input to your program from the keyboard: Hello are you lend Hello dear! How are you doing? lend Output from your program on the screen: olleH dear How era uoy doing

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Python program that reverses the words in an input sentence import ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!