Whenever I enter my code, it shows an error message with some random combination of numbers which the function computes incorrectly.
It is supposed to calculate the price for the food taking in account the stock, but it does not do that. It just shows the error message. Please help if you can!
Here is the code I am using for the function.
Any help would be greatly appreciated!
Some coding apprentice who can't figure out this problem of his
def compute_bill(food): total = 0 for key in food: if key(stock) > 0: total = total + prices[key] else: total = total + 0 return total stock[key] = stock[key] - 1