12. Stockiing Out


#1



https://www.codecademy.com/courses/python-beginner-en-IZ9Ra/2/3?curriculum_id=4f89dab3d788890003000096


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


#2

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


#3

I just ran it again and it worked. Thanks!


#4

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