Untitled

 avatar
unknown
plain_text
2 years ago
582 B
11
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...