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()
- value = int(value)
- if key not in products:
- products[key] = {price: int(value)}
- else:
- products[key] = {price: int(value)}
- data = input()
- for key, value in products.items():
- for nested_key, nested_value in value.items():
- # products[key] = nested_key
- # products[key][nested_key] = nested_value
- products[key] = float(nested_key) * int(nested_value)
- for key, value in products.items():
- print(f"{key} -> {products[key]:.2f}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement