12. Stockiing Out



The error message I get says
File "python", line 24
return total
IndentationError: unindent does not match any outer indentation level

Can anyone explain what's wrong with this code?

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


The iterator variable is item and the running variable you are using is key. Looks like a pasting in error.


I just ran it again and it worked. Thanks!


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