As a general rule, it's not recommanded to modify a sequence you are iterating upon. The below function is similar to your map.
def deleting_while_iterating(iterable):
for i in iterable:
iterable.remove(i)
print(f"i: {i}, iterable: {iterable}")
If I give this function your input, the output is:
i: 1, iterable: ['2', '3', '4', 'a', 'b', 'c']
i: 3, iterable: ['2', '4', 'a', 'b', 'c']
i: a, iterable: ['2', '4', 'b', 'c']
i: c, iterable: ['2', '4', 'b']
As you can see, after the first iteration, "2" who originally was at index 1 is now at index 0. However, i
is now at index 1 and thus "2" will be skipped. That's why it's better to create a new list containing only the elements you want. There are different ways to do it.