Ad
  • Custom User Avatar

    I was doing something similar and getting the same error. Then added some print functions to try and see what was going on and realised it wasn't doing as many loops as expected. Then realised this is because you are deleting items from the list being iterated, so when it completes a loop where it deletes an item, the list shortens and the next item in the list goes to the current index and it moves to the next iteration if there is one.