Stocking out


#1



https://www.codecademy.com/en/courses/python-beginner-en-IZ9Ra/2/3?curriculum_id=4f89dab3d788890003000096

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.


#2

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


#3

Thanks I thought I tested that before. Much appreciated


#4

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