Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In python Start with the lists provided. *Do Not Alter These Lists don't use while True: currrentNames = [Shanice, 'Carey, Terrence, Pat'] validCmds = ('list',

image text in transcribed
image text in transcribed
In python Start with the lists provided. *Do Not Alter These Lists don't use "while True: currrentNames = ["Shanice", 'Carey, "Terrence", "Pat'] validCmds = ('list', "count", "sort","show"] validActs = ['add', 'remove', 'position'] In a loop, you will ask for user input and respond accordingly until the user is done. Ask the user for input using this string: precede this string with a single newline character for space between this string and the end of any previous command. - Enter a command (Press ENTER to quit) Split the input on the space character. If the input is empty(ENTER), your program is done. Print the word "Done!" If the input contains only one item, treat it as a command. If the input contains two items, treat the first item as an action and the second item as a name. The various commands: list - Print the current list, e.g.: Current List: ['Luke', 'Mike, "Rob', 'Pat'] count - Indicate how many assistants are in the current list, eg.: There are 4 names in the current list. sort - Sort the current list and then say that it is done, i.e.: Current list has been sorted. show - Like list, you're just showing the content of the current list, but in a pretty format. eg.: Current List #0 = Luke #1 = Pat # 2 = Mike # 3 = Rob The various actions add - add a new name to the current list. - if the requested name is already in the list, say so, e.g.: Pat is already in the current list! - otherwise, add the name to the list and say so, e.g.: Martin has been added to the current list remove - remove an existing current name from the current list. - if the requested name is not already in the list, say so, e.g.: Rihanna is not in the current list! - otherwise, remove the name from the list and say so, eg.: Rihanna has been removed from the current list position: (reported positions should be 1-based, not O-based.) - indicate the position of current name in the current list. - if the requested name is not already in the current list, say so, e.g.: Brady is not in the list of assistants! - otherwise, indicate the position, e.g.: Brady is in position #2 in the current list. *If an invalid single-word input is given, the following error is presented. E.g.: display 'display' is not a valid command The valid commands are: ('list', 'count', 'sort', 'show'] *If an invalid dual-word input is given, the following error is presented. E.g.: rewrite Path 'rewrite' is not a valid action The valid actions are: ['add', 'remove', 'position']

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

Relational Database Design A Practical Approach

Authors: Marilyn Campbell

1st Edition

1587193175, 978-1587193170

More Books

Students also viewed these Databases questions

Question

What is job description ? State the uses of job description.

Answered: 1 week ago

Question

What are the objectives of job evaluation ?

Answered: 1 week ago

Question

Write a note on job design.

Answered: 1 week ago

Question

Compute the derivative of f(x)cos(-4/5x)

Answered: 1 week ago

Question

1. Who should participate and how will participants be recruited?

Answered: 1 week ago

Question

3. How would this philosophy fit in your organization?

Answered: 1 week ago

Question

How would you assess the value of an approach like this?

Answered: 1 week ago