Stocking Out


#1




Oops, try again. stock doesn't look quite right! Make sure to not call compute_bill since it changes the stock! It should contain: {'orange': 32, 'pear': 15, 'banana': 6, 'apple': 0}

whats wrong with my code? It sends this error message and outputs 8.5.

def compute_bill(food):
    total = 0
    for x in food:
        if stock[x] > 0:
            total +=prices[x]
            stock[x] -= 1
    return total
print compute_bill(prices)


#2

Make sure to not call compute_bill since it changes the stock!

Take out

print compute_bill(prices)

#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.