Question
Using python: Prompt the user to enter a sentence. Store the text as a string. After user input, the program should output the entered string
Using python:
-
Prompt the user to enter a sentence. Store the text as a string. After user input, the program should output the entered string before printing the menu options in part 2. For example: Please enter a sentence:
The most certain way to succeed is to always try one more time! You entered: The most certain way to succeed is to always try one more time!
-
Display a Menu, as shown in the example below. Each option is represented by a single character.
For example: You entered: The most certain way to succeed is to always try one more time!
MENU c - Number of non-whitespace characters w - Number of words r - Reverse the order of the words in the sentence. q Quit. Choose an option:
If an invalid character is entered, continue to prompt for a valid choice. Continue to display menu options until the user enters q to Quit.
-
Implement a function to count and returns the number of characters in the string, excluding all whitespace. For example: Number of non-whitespace characters: 51
-
Implement a function to returns the number of words in the string. For example:
Number of words: 13
-
Implement a function to reverse each word of the entered sentence individually to display the sentence in reverse. For example: Output: time! more one try always to is succeed to way certain most The
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started