12. Stocking out


#1



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


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


#2

the error message:

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

tells you have an indention problem


#3

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


#4

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


#5

make sure you indent the two lines below your if statement


#7

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


#8

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

        total += prices[item]

#9

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


#10

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


#11

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