python - Codecademy supermarket "subtract" error -
I have started programming in Python on codecademy, and I have a problem:
The following changes For your compute_bill function:
- When you loop through each item of food, then only add the price of the item when the item's stock is more than zero.
- If the item is in stock and you add value to the total, then deduct one of the item's stock calculation. "
My code reads:
Shopping_list = [" banana "," orange "," apple "] stock = {" banana ": 6 "Apple": 0, "orange": 32, "pear": 15} prices = {"banana": 4, "apple": 2, "orange": 1.5, "pear": 3} def compute_bill ): Total for each = 0 in the food: if the stock [every]> gt: total + = value [every] stock [every] - = 1 total food return = ["banana", "orange", "apple"] compute_bill (food)
I have this error
Oh, try again. Stock does not look right at all! Make sure that do not call
compute_bill because this stock changes! It should be included: {'orange': 32, 'pear': 15, 'banana': 6, 'apples': 0 }
I do not understand why the problem is.
The message says
Be sure not to call
Compute_bill ...
but your code includes:
compute_bill (food)
remove that line
Comments
Post a Comment