Answer to Question #270209 in Python for tytyuikol

Question #270209

Assume that a grocery shop is introducing shopping through mobile. The shop keeper will gets the list of items from the customer through whatsApp. After receiving the list he will prepare the bill for the customer based on the availability of the items. That is, the shopkeeper will check whether the item is available or not by checking the stock in the shop, if the item is available he will add that item to the bill otherwise he will add that item to another list called not-available list. Finally the shopkeeper will send the bill and the not available list to the customer for confirmation. Write a python code to simulate mobile shopping for a grocery shop to generate bill and not available list. Hint : Create the stock list that contains item, unit price and available quantity. 


1
Expert's answer
2021-11-23T05:18:59-0500
product = {} 
foo = [] 


test = False 


while not test:
    product_name = input("product name:\n")   
    amount = input("amount purchased:\n")   
    cost = input("Price per item:\n")
    product = {'name':product_name, 'number': int(amount), 'price': float(cost)}
    foo.append(product)
    user_input = input("Would you like to continue?\nType 'c' for continue or 'q' to quit:\n")
    if user_input == 'q':
      test = True
    

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS