Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- products = {}
- command = input()
- while command != "statistics":
- command_split = command.split(": ")
- product = command_split[0]
- quantity = int(command_split[1])
- if product not in products:
- products[product] = 0
- products[product] += quantity
- command = input()
- print("Products in stock:")
- for (product, quantity) in products.items():
- print(f"- {product}: {quantity}")
- print(f"Total Products: {len(products.keys())}")
- print(f"Total Quantity: {sum(products.values())}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement