Can you look at my code?


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


What is the error message coming up?


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


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


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

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


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