Skip to content

Instantly share code, notes, and snippets.

@albertz
Forked from anonymous/script.py
Last active April 19, 2016 08:47
Show Gist options
  • Save albertz/74723458c51b71c638a84500a9bcaab5 to your computer and use it in GitHub Desktop.
Save albertz/74723458c51b71c638a84500a9bcaab5 to your computer and use it in GitHub Desktop.
shopping_list = ["banana","apple","orange", "orange", "apple"]
stock = {
"banana": 6,
"apple": 0,
"orange": 32,
"pear": 15
}
prices = {
"banana": 4,
"apple": 2,
"orange": 1.5,
"pear": 3
}
# Write your code below!
def compute_bill(food):
total = 0
for x in food:
if stock[x] != 0:
total += prices[x]
stock[x] -= 1
return total
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment