12 .Stocking out function unable to retrive


#1



i am stuck in stock count removing one from present value and unable to access


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}


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


#2

you can't call the function in this exercise, given this will change the stock before the validition can run

Its pretty much in the error message?


#3

while i running the program it show
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}
i am ask how to less the count in the stock and then print the value ?


#4

this is the bit of the error message you should focus on, remove your function call


#5

thanks i understand the problem now


#6