Stock[item]=stock[item]-1


#1

Can someone explain why do we use Stock[item]=stock[item]-1?
and if stock[item] > 0: also


#2

Hello @ace147 ,
First you should have put this in Python Q & A and also provided the link ,code etc,It will help other to help you better. :slight_smile:
That line of code keep updates the number of fruits in the stock.
With respect to the exercise...

As a shopkeeper everyone needs to check how many items they have sold and how many of the items are remaining.

I have written an answer here, I hope it helps you to understand it better.