Stocking out


#1

Write your code below!

def compute_bill(food):
total = 0
for item in food:
if stock[item] > 0:
total += prices[item]
stock[item] = stock[item] - 1
return total
print stock[item]
please could you show where the function is called and when we supply the argument, thanks


"Stocking Out" Please, can you explain the logic behind it?
#2

the function isn't called since this might manipulate the stock which causes problems with validation.

You can call the function at any point after you defined it, when you call the function you can supply arguments.

At this point, you should know how to call functions, i demonstrated it here

Otherwise, consult earlier lessons/documentation to refresh your memory about function calls


#3

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