Created
August 15, 2021 04:28
-
-
Save julia-git/6ff9fa541334c6be4897d7a12bcb1e4f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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': 3, 'spinach' : 3, 'artichoke': 5, 'apple': 10, 'banana': 7} | |
order2 = {'dragonfruit': 10, 'apple': 4, 'lettuce': 2} | |
order1_total = 0 | |
order2_total = 0 | |
for item, quantity in order1.items(): | |
order1_total += store_dict[item] * quantity | |
print(order1_total) | |
for item, quantity in order2.items(): | |
order2_total += store_dict[item] * quantity | |
print(order2_total) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment