Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data = input()
- products = {}
- while data != "buy":
- key, price, value = data.split()
- if key not in products:
- price = float(price)
- value = int(value) * price
- products[key] = float(value)
- else:
- price = float(price)
- value = int(value) * price
- products[key] += float(value)
- data = input()
- for key, value in products.items():
- print(f"{key} -> {products[key]:.2f}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement