Does anyone know how to sum all the values, for all the items, in ‘total_price’.
My best attempt below, I got as far as getting the values but couldn’t sum them together.
It would be great if someone could tell me how to do it. (Code is condensed btw - part of a much larger, work in progress, program).
order_dictionary = {'Ham & Cheese': {'quantity': 2, 'price': 5, 'total_price': 10}, 'Hawaiian': {'quantity': 4, 'price': 5, 'total_price': 20}}
print("\n" + "*"*60 + "\nYour order:" + "\n")
for items in order_dictionary.items():
idx, item = items
print(f" {idx: <27} x{int(item['quantity']): <6} ${item['total_price']:.2f}\n")
for food, info in order_dictionary.items():
total = info['total_price']