a store has different categories of products in stock
Attachments:
Answers
Answered by
2
Programing Language : Python
Item_Number = [101,102,103,104]
Item_Name = ["Milk","Cheese","Ghee","Bread"]
Price = [42,50,500,40]
Stock = [10,20,15,16]
item = int(input("Enter the item number : "))
quantity = int(input("Enter the quantity : "))
if item in Item_Number:
item_index = Item_Number.index(item)
if quantity <= Stock[item_index]:
print(f"{float(quantity*Price[item_index])} INR")
Stock[item_index] = Stock[item_index]-quantity
print(f"{Stock[item_index]} LEFT")
else:
print("No Stock")
print(f"{Stock[item_index]} LEFT")
else:
print("Invalid Input")
OUT_PUT :
Enter the item number : 102
Enter the quantity : 15
750.0 INR
5 LEFT
Similar questions