Can you look at my code?


#1

I am still having trouble with this. Can you look at my code?

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

#2

What is the error message coming up?


#3

I think the for loop has to be like this
for item in food:


#4

Might make you feel good, for the moment, but what does it do for the learning experience? Answers are not the answer. Questions are.


#5

You're not using the 'food' parameter anywhere in your function block.

Your for-loop should loop through... what? Not prices, right?


#6

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