Computer Science, asked by mayurrathore671, 1 month ago

Note A store has different categories of produs shown below. Item Number= (101, 102 103 1047 Item Name= (Milk Cheese Chee Bread Price=[42. 50, 500, 40/ Stock={10,20. 15. 16 When user give input with 2 venues as 1. Item number for item which werwis 2. Quantity for the item entered to When user enters above input me: stock 1. If quantity is less than stock and remis display a routication messages Output Linel price INR pnce in float with precision Output Like2: quanten LEFT stock for frem after purchase 2. If the quantity to stock is the user while placing order the day Ourut unel. NO STOCK Oumpur Une quantity LEFT 3. Ifuser enter coding question


Answers

Answered by poojan
4

Language used: Python Programming

Program:

#defining lists

ItemNumber= [101, 102, 103, 104]

Item Name= [Milk, Cheese, Ghee, Bread]

Price= [42, 50, 500, 40]

Stock= [10, 20, 15, 16]

#Taking the inputs

itemnum = input()

quantity = input()

#checking if no characters are inputted and if the itemnumber entered is present in the given list or not

if itemnum.isnumeric() and quantity.isnumeric() and (itemnum in ItemNumber):

   itemnum=int(itemnum)

   quantity=int(quantity)

   #taking the index of the itemnumber for further usage

   for i in range(len(ItemNumber)):

       if itemnum == ItemNumber[i]:

           indexx=i

           break

   #Print the bill, if the asked quantity is available in the stock; update the stock and print the stock left.

   if (quantity<=Stock[indexx]):

       print("{:.1f} INR".format(quantity*Price[indexx]))

       Stock=Stock[indexx]-quantity

       print("{0} LEFT".format(Stock[indexx]))

   #Print the NO STOCK left message if the quantity asked is greater than the stock available and print the stock in availability.

   elif quantity>Stock[indexx]:

       print("NO STOCK")

       print("{0} LEFT".format(Stock[indexx]))

#When the invalid value is inputted by the user

else:

   print("INVALID INPUT")

Learn more:

Write a statement to add a Key: Value Pair of 7:49 to dictionary  D={1:1,3:9,5:25}

https://brainly.in/question/43499112

Your friend and you made a list of topics and both of them voted if they like or dislike the topic. They wrote 0 to denote dislike and 1 to denote like..

brainly.in/question/44681897

Similar questions