Untitled
unknown
plain_text
3 years ago
774 B
12
Indexable
#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()
Editor is loading...