Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 2 Tbere are 5 specified items available in some stationery iaventory. The eode in Appendix I provides a user interactive input to update the

image text in transcribed

Question 2 Tbere are 5 specified items available in some stationery iaventory. The eode in Appendix I provides a user interactive input to update the correspoading quantity and list price of the stationery inventory till the user expresses not to eontinae. The apdated information is then stored temporarily in a variable, called "updated_inventory". (a) Provide a critique of the code in Appendix 1 in bullet points and explain bow the code can be better written. (10 marks) (b) Using Python, rewrite the code in Appendix 1 based on the critique and suggestions in 2(a). The rowritten code sbould achieve a similar outoove and store the updated information entered by the user in a variable. Provide the rewritten code and corresponding output in text format in the repart, Screensbots of the codes are not permitted and doing so will attract a 10 -mark deduction. (25 marks) Appendix 1 inventory = ['pen', 'pencil', 'ruler', 'eraser', 'marker'] print(f'This is the list of stationery inventory available \{inventory }.'nPlease enter any one of them.') continue_query = 'yes' updated_inventory = [] while continue_query =- 'yes" : stationery = str(input("What is type of stationery to be updated? ")) qty = (input("What is current quantity? ")) price = (input("What is the current list price? ")) entered_input = [stationery,qty,price] updated_inventory.append(entered_input) continue_query = str(input("Would you like to continue? (Indicate yes or no)"))

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

Cite the reasons employees join unions.

Answered: 1 week ago