How would I be able to check if a user input equals a key in my dictionary? This is what I have so far:
dict_inventory = {
"Blue Large Gloves": {"Manufacturer": "NA", "Order ID": "PHGLOVLG", "Amount in stock": 20, "Par": "2", "Lot Number": "123456", "Lot Expiration": datetime.date(2023, 3, 5)},
"BacT Bottles": {"Manufacturer": "Biomerieux", "Order ID": "NA", "Amount in stock": 2, "Par": 3, "Lot Number":"789456", "Lot Expiration": datetime.date(2021, 5, 26)},
"pH Buffer 10": {"Manufacturer" : "ThermoScientific", "Order ID": "NA", "Amount in stock": 10, "Par":10, "Lot Number": "35678", "Lot Expiration": datetime.date(2020, 3, 14)}
}
item_taken = input("Which item was taken from stock?: ")
for k in dict_inventory:
if item_taken == dict_inventory[k]:
user_int = int(input(f"How many {item_taken} were taken from stock?: "))
dict_inventory[item_taken]["Amount in stock"] -= user_int
else:
print("Item does not exist")#