Stocking Out: why don't we return stock?


#1



I return stock[item] in my code and it works, but if I remove that line completely, the code still works. Why don't we need to return the stock[item] too?


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


#3

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