C2W1_Assignment_fixed the result in Google Lab is correct however failed the grade

Can please help me:

C2W1_Assignment: GRADED FUNCTION: split_data

My Output

666.jpg is zero length, so ignoring.
11702.jpg is zero length, so ignoring.

Original cat’s directory has 12500 images
Original dog’s directory has 12500 images

There are 11249 images of cats for training
There are 11249 images of dogs for training
There are 1250 images of cats for validation
There are 1250 images of dogs for validation


Expected Output

666.jpg is zero length, so ignoring.
11702.jpg is zero length, so ignoring.

Original cat’s directory has 12500 images
Original dog’s directory has 12500 images

There are 11249 images of cats for training
There are 11249 images of dogs for training
There are 1250 images of cats for validation
There are 1250 images of dogs for validation


Graded

All tests passed for create_train_val_dirs!

Details of failed tests for split_data

Failed test case: incorrect number of (training, validation) images when using a split of 0.5 and 12 images (6 are zero-sized).
Expected:
(3, 3),
but got:
(4, 5).

What happen here?

Thank you

The test case has 12 images out of which 6 images are of zero length. The expectation is that the training and validation sets should have 3 images each when split is .5. Your method splits the data into sets of 4 and 5 images.
This is likely to happen if you’re modifying a collection while iterating over it. If that’s not the case, please click my name and message your notebook as an attachment.

From the learner:

Ah thanks for your input, i found the bug, the loop does not update the list, I have to create new list to store the desired result. thanks for the hint