Untitled
unknown
plain_text
3 years ago
582 B
14
Indexable
# Create an empty warehouse dictionary
warehouse = {}
# Function to add new products to the warehouse
def add_products():
products = []
while True:
name = input("Enter product name (or 'q' to quit): ")
if name == "q":
break
price = float(input("Enter product price: "))
quantity = int(input("Enter available quantity: "))
products.append((name, price, quantity))
for product in products:
name, price, quantity = product
warehouse[name] = {"price": price, "quantity": quantity}
Editor is loading...