Stocking out: Problem


#1



I keep getting error alert:
File "python", line 21
total += prices[item]
^
IndentationError: expected an indented block

That part of the code worked on the previous exercise, why not in this one?


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


#2

You need to indent the code lines inside the if-block.
When a new statement is introduced (here if-statement), the code inside of it must be indented (generally by 4 space bars).


#3

Like allways, I realized this right after sending the question. Thanks anyay!


#4

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