Last active
December 20, 2015 23:58
-
-
Save stevencombs/6216244 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
# Computer the bill for a shopping list | |
# A Codecademy Python (Making a Purchase) assignment | |
# Dr. Steven B. Combs, coding novice | |
groceries = ["banana", "orange", "apple"] | |
stock = { | |
"banana": 6, | |
"apple": 0, | |
"orange": 32, | |
"pear": 15 | |
} | |
prices = { | |
"banana": 4, | |
"apple": 2, | |
"orange": 1.5, | |
"pear": 3 | |
} | |
# Code below is incorrect. Need to Redo! | |
def compute_bill(food): | |
total = 0 | |
for cost in food: | |
total = total + prices[cost] * stock[total] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment