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:

  1. 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!

  2. 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.

  3. 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

  4. Implement a function to returns the number of words in the string. For example:

    Number of words: 13

  5. 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

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!