Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(b) Provide a critique of the code in Appendix 1 in bullet points and explain how the code can be better written. (10 marks)

 

(b) Provide a critique of the code in Appendix 1 in bullet points and explain how the code can be better written. (10 marks) Using Python, rewrite the code in Appendix 1 based on the critique and suggestions in 2(a). The rewritten code should achieve a similar outcome and store the updated information entered by the user in a variable. Provide the rewritten code and corresponding output in text format in the report. Screenshots 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(fThis is the list of stationery inventory available [inventory). Please enter any one of them.") continue query-"yes" updated inventory -[1 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

SOLUTION a Critique of the code in Appendix I Syntax Errors There are multiple syntax errors in the code such as missing colons after statements missing quotation marks around strings and incorrect va... 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

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions