Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
774 B
0
Indexable
Never
#EXE4_Create a function to remove a product from the warehouse, 
#taking as input the product name.


def remove_product():
    # Get product names
    products = input("Enter the names of the products in the warehouse, separated by commas: ")
    products = products.split(",")

    # Create warehouse dictionary
    warehouse = {}
    for product in products:
        warehouse[product] = 0

    # Remove product
    product_name = input("Enter the name of the product to remove: ")
    if product_name in warehouse:
        del warehouse[product_name]
        print(f"Product {product_name} has been removed from the warehouse.")
    else:
        print(f"Product {product_name} was not found in the warehouse.")

# example usage
remove_product()