Skip to content

Instantly share code, notes, and snippets.

Created April 19, 2016 08:42
Show Gist options
  • Save anonymous/5482f11397794a206db70f22e1994ef9 to your computer and use it in GitHub Desktop.
Save anonymous/5482f11397794a206db70f22e1994ef9 to your computer and use it in GitHub Desktop.
hopping_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]+total
stock[x]=stock[x]-1
return total
print(compute_bill(shopping_list))
print(stock)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment