I am writing a piece of code that goes through a list and if the item meets a certain criteria, it is added to a different list and deleted from the current list. For example:
for item in range(len(myList)):
if (Insert Condition):
newList.append(item)
del(myList[item])
When I do this, I receive a 'list assignment index out of range' error.
Is this occurring because the range that the loop must go through is now longer than the list itself?