12 is working!. oops


#1

def compute_bill(food) :
total = 0

for item in food:
    if stock[item] > 0 :
        total = total + prices[item]
        stock[item] = stock[item] -1
    else :
        total = total
return total

print compute_bill(shopping_list)

The code is not working..
So I add "#" at the final line.

print compute_bill(shopping_list)

...... Um....


#2

We shouldn't need this bit of code:

    else :
        total = total

The rest of your code looks okay, though it can be simplified by using add/minus assignment operators:

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