Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In an electronic shop, laptops of brands 'Dell', 'HP', 'Lenovo', 'Sony', 'Acer' are available. Unit price of the brands of pen drive is 40000, 42000,

In an electronic shop, laptops of brands 'Dell', 'HP', 'Lenovo', 'Sony', 'Acer' are available. Unit price of the brands of pen drive is 40000, 42000, 40180, 39400 and 39300 respectively and the available stock in hand is 10 for Dell,100 for HP, 50 for Lenovo, 4 for Sony, and 2 for Acer. A customer can enter the name of the brand of the laptop he wants to purchase and the required quantity. Develop the Python code to keep track of the total bill amount. The program should keep asking for new items until 'stop' is entered for the brand name. The program should display the total amount. The brand name entered by the customer should be made case insensitive and if the user enters quantity greater than stock in hand then print STOCK INSUFFICIENT. If the brand entered by the user is not in the shop then print NOT AVAILABLE. But in both, the cases compute cost for other items entered and continue getting new items. Print the items ordered by the customer in upper case and unit price of the item as a dictionary in sorted order and then the total cost to be paid by the customer.

[Hint: use pprint function for printing dictionary in sorted order.

Syntax for pprint is

pprint(dictionary name)

Include the line from pprint import pprint in the top of your program]

Input Format:

Name of the first item

Quantity of the first item

. . .

Output Format:

Items ordered by the customer and their unit price as a dictionary

Total Bill amount

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

Database Systems A Practical Approach To Design Implementation And Management

Authors: THOMAS CONNOLLY

6th Edition

9353438918, 978-9353438913

Students also viewed these Databases questions