Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def orders():
- dictionary_value = {}
- dictionary_quantity = {}
- while True:
- command = input().split(" ")
- if command[0] == "buy":
- break
- index_one = str(command[0])
- index_two = float(command[1]) # Price
- index_three = int(command[2])
- if index_one not in dictionary_quantity.keys():
- dictionary_quantity[index_one] = index_three
- else:
- dictionary_quantity[index_one] += index_three
- if index_one not in dictionary_value.keys():
- dictionary_value[index_one] = index_two
- if index_two not in dictionary_value.values():
- dictionary_value[index_one] = index_two
- result = {k: dictionary_value[k] * dictionary_quantity[k] for k in dictionary_value}
- for key,value in result.items():
- print(f"{key} -> {value:.2f}")
- orders()
Advertisement
Add Comment
Please, Sign In to add comment