Here when we iterate over the classes in the class wise data

here why is data[i]=[] an empty list and what are we doing in , how are we appending it in the dict, can you please explain

for i in classes :
data[ i ] = [ ]
so in this piece of code what we are doing is we are actually creating a dictionary of classes labels to be as keys and there values to be a empty list.
And in the next for loop, while we are iterating over images , we are appending image data to corresponding label key value of the dictionary which we created above. So we are not actually appending to a dictionary but we are appending to a particular key value ( which is our label ) in the dictionary.

hey @sankalparora5 , i hope your doubt is now resolved.
if it is so, then kindly mark this doubt as resolved and also provide your valuable feedback as it helps us to improve our method of working .

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.