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