12. Stocking out



Don't understand where I'm going wrong. Help needed.

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


the error message:

File "python", line 22
total += prices[item]
IndentationError: expected an indented block

tells you have an indention problem


please help me !!!


the url is the same for everyone, it checks for user to load that users code. Please make a new topic, fill in the template so we have all the details needed to help you


make sure you indent the two lines below your if statement


Indent your total... statement. that should fix it.


Indent your total... statement. that should fix it.

        total += prices[item]


I don't understand what you actully meaned? Make a new topic means i have to change the full coding?


go here, in the top right you see + new topic button.


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