12. stocking out


I wonder why do I use 1 in stock[x]-=1.
I think we subtract how many we buy in stock.

please, explain for me.

12. Stocking Out - Code not working

the for loop will loop over all the items you buy, each time you subtract one. So if you buy the same item multiply times, each time one will be subtracted thanks to the for loop.