Something of Value


#1

Here is my code and I keep getting an error message saying I am not getting the correct total. What am I doing wrong?

prices = {
    "banana" : 4,
    "apple"  : 2,
    "orange" : 1.5,
    "pear"   : 3,
}
stock = {
    "banana" : 6,
    "apple"  : 0,
    "orange" : 32,
    "pear"   : 15,
}

for key in prices:
    print key
    print "price: %s" % prices[key]
    print "stock: %s" % stock[key]
    
def compute_bill(food):
    total=0
    
    for key in food:
        if stock[key] > 0:
            total += prices[key]
            stock[key] = stock[key] - 1
    return total


#2

are you sure you are at something of value? This is the code for the last exercise

for this exercise, you need to calculate how much buying everything would cost/how much your entire stock is worth


#3

Oops, nevermind, I figured it out. Thanks!


#4