Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Discuss the Hawthorne experiments in detail

Answered: 1 week ago

Question

Explain the characteristics of a good system of control

Answered: 1 week ago

Question

State the importance of control

Answered: 1 week ago

Question

What are the functions of top management?

Answered: 1 week ago