Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created June 9, 2017 02:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/1b1d66963776f12577fde2ba20fe5eff to your computer and use it in GitHub Desktop.
Save codecademydev/1b1d66963776f12577fde2ba20fe5eff to your computer and use it in GitHub Desktop.
Codecademy export
shopping_list = ["banana", "orange", "apple"]
stock = {
"banana": 6,
"apple": 0,
"orange": 32,
"pear": 15
}
prices = {
"banana": 4,
"apple": 2,
"orange": 1.5,
"pear": 3
}
def compute_bill(food):# Write your code below!
total = 0
for x in food:
if stock[x] > 0:
total += prices[x]
stock[x] -= stock[x]
return total
food_list = ["apples","cumquats"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment