Stocking out


Getting error messages: for example calling compute_bill (1 apple, 1 pear, 2 oranges, and 9 bananas) result in 7 instead of the correct 30.0

So I'm confused on what to do because when I go to the next lessons the code is the same as mine. The only thing I gather is that I need to multiply the price by the amount of fruit in stock, but how would you do that? My code is simply adding the price of each fruit; for example, code reads banana, orange, pear in stock, total will be 8.5. What I want and cannot solve is reading the amount of fruits in stock then multiply that number by the price.


the problem is only line 23, even when the customer is only buys one item, you reduce the stock of that item to zero.

so if someone buys one banana, the stock will go from 6 to 0


Thanks I thought I tested that before. Much appreciated


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