Skip to content

Instantly share code, notes, and snippets.

@julia-git
Created August 14, 2021 21:49
Show Gist options
  • Save julia-git/cfa0bf57eca3466713c417d49e223538 to your computer and use it in GitHub Desktop.
Save julia-git/cfa0bf57eca3466713c417d49e223538 to your computer and use it in GitHub Desktop.
veggies + fruits
veg_dict = {'cabbage': 3.57, 'carrot': 2.99, 'spinach': 4.13, 'asparagus': 3.56, 'artichoke': 4.00, 'lettuce': 3.83}
fruit_dict = {'peach': 0.65, 'banana': 0.23, 'watermelon': 2.45, 'apple': 0.99, 'dragonfruit': 1.23}
store_dict = {**veg_dict, **fruit_dict}
order1 = {'cabbage': 2, 'spinach' : 3, 'artichoke': 5, 'apple': 10, 'banana': 7}
order_total = 0
for item, quantity in order1.items():
order_total += store_dict[item] * quantity
print(order_total)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment