Making a purchase - how does the function know to look at the shopping_list?


The correct code shown for this exercise is:
def compute_bill(food):
total = 0
for item in food:
total = total + prices[item]
return total

I’m confused how the correct code gets just the items in shopping_list.


It will know it by what we pass into the function through its food parameter.


shopping_list is the argument of the function call.


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