Created
April 19, 2016 08:42
-
-
Save anonymous/5482f11397794a206db70f22e1994ef9 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
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