Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create the Python module Project 4 that utilizes the list below for course categories. This Python module will be menu driven and use conditions to

Create the Python module Project 4 that utilizes the list below for course categories. This Python module will be menu driven and use conditions to check user input in order to determine which list operation to perform based on the users menu selection.The output should look like the attached example output.

courseCategories = [

"Mathematics",

"Computer Science",

"Business",

"Economics",

"Literature",

"Art",

"Music"

]

The menu will have the following selections (NOTE: all menu selections by the user should not be case sensitive):

1. SR Sort

a. This operation will display the list before being sorted

b. Display the list to the user after being sorted

2. CC Character Count

a.This operation will prompt the user for an index as an integer that will be the location to reference in the list

b. If the integer is less than 0 or greater than the last possible index in the list, display the

following error message:

i.

"You entered an invalid index!"

c.

If the integer is a valid index value, display the value in the list at that index along with

its associated length using the following message:

i.

"The value at index is and is index> characters long."

3. AS Add String at Index

a.This operation will prompt the user for the index as

an integer that will be the location where a string will be inserted

b. If the integer is less than 0 or greater than the last possible insertion index in the list, display the following error message:

i. "You entered an invalid index!"

c. If the integer is a valid index value, prompt the user to enter a string:

i. Display the list to the user before the string has been inserted into the list

ii. Take the string entered by the user, and insert it into the course categories list at the index specified.

iii. Display the list to the user after the string has been inserted into the list

4. EX Exit

a. This operation will display Goodbye! to the user

NOTE:

If any menu selection other than AR, CC, AS, or EX is entered:

Display the message You entered an invalid menu selection to the user

At the end of the Python module print the string End of Project #4image text in transcribedimage text in transcribedimage text in transcribed

Page of 4 _-ZOOM Invalid Index Value MENU SR -Sort * CC -Character Count* ASAdd String EX EXIT Enter your choice: cc Enter an index for the list: 10 You entered an invalid index! End of Project #4 'AS'-Add String Page of 4 ZOOM 'AS'-Add String Valid Index Value MENU SR-Sort * CC- Character Count AS Add String EXEXIT Enter your choice: as Enter an index for insertion of a string into the list: 2 Enter a string to insert into the list: History BEFORE INSERT: ['Mathematics Computer Science'Business' 'Economics','Literature''Art', 'Music' AFTER INSERT:'Mathematics', 'Computer Science', 'HistoryBusiness' Economics' End of Project #4 Literature Art,'Music' Invalid Index Value MENU SR-Sort * CC- Character Count AS -Add String EX-EXI Enter your choice: As Enter an index for insertion of a string into the list: 10 You entered an invalid index! End of Protect EX'-Exit Page of 4 ZOOM SR' Sort MENU SRSort * cc- character count * *AS Add String EX-EXIT Enter your choice: sr BEFORE SORT: ['Mathematics',Computer Science',BusinessEconomics' Literature', 'Art', 'Music' AFTER SORT: ['Art', 'Business'Computer Science''Economics' Literature' 'Mathematics' 'Music' End of Project #4 'CC' -Character Count Valid Index Value MENU SR-Sort cc- character count *AS Add String *EX-EXIT Enter your choice: co Enter an index for the list: 5 The value at index 5 is Art and is 3 characters long End of Project Invalid Index Value MENU

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_2

Step: 3

blur-text-image_3

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

Systems Analysis And Synthesis Bridging Computer Science And Information Technology

Authors: Barry Dwyer

1st Edition

0128054492, 9780128054499

More Books

Students also viewed these Databases questions