for a function to execute, you need to call it. Add several function calls with different arguments to see how the
food parameter is working
Apologies. I know i need to do that but I dont understand how to make a function call and I cant see any examples
I guess what I am missing is the understanding the line between…
total = 0
for item in food:
if stock[item] > 0:
total += prices[item]
stock[item] -= 1
and the shopping list?
Functions have been taught? You can always check documentation or earlier lessons if you need a syntax refresher.
compute_bill(‘banana’) is indeed a function call, but
'banana' is a string. The function call should get a list as argument, for example
a parameter (
food in your case) gets its value from the argument at function call
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.