Input required for checking out multiple amounts of an item

shopping_list = [“banana”, “orange”, “apple”]
stock = {
“banana”: 6,
“apple”: 0,
“orange”: 32,
“pear”: 15

prices = {
“banana”: 4,
“apple”: 2,
“orange”: 1.5,
“pear”: 3
total = 0
for item in food:
if stock[item]>0:
total = total + prices[item]
stock[item] = stock[item] - 1
return total


When I print the shopping_list, the output I get is 5.5 in which an orange and a banana is checked out. So what if I want to purchase more amount of oranges or bananas? how should I change the list?


If I remember correctly, that is covered in a later lesson. Not sure, though. Please post a link to the exercise. Thanks.


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