The problem is that you use the same list in your loop condition and inside.
# List to loop x over
listB = [i for i in range(5)]
# List to manipulate with remove
listA = [i for i in range(0, 10)]
for x in listB:
print('loop: %s'%x)
print('list before removing %s'%x)
print(listA)
listA.remove(x)
print('list after removing %s'%x)
print(listA)
# Re-initialize listA
listA = [i for i in range(x, 10)]
This produces the following output:
loop: 0
list before removing 0
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
list after removing 0
[1, 2, 3, 4, 5, 6, 7, 8, 9]
loop: 1
list before removing 1
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
list after removing 1
[0, 2, 3, 4, 5, 6, 7, 8, 9]
loop: 2
list before removing 2
[1, 2, 3, 4, 5, 6, 7, 8, 9]
list after removing 2
[1, 3, 4, 5, 6, 7, 8, 9]
loop: 3
list before removing 3
[2, 3, 4, 5, 6, 7, 8, 9]
list after removing 3
[2, 4, 5, 6, 7, 8, 9]
loop: 4
list before removing 4
[3, 4, 5, 6, 7, 8, 9]
list after removing 4
[3, 5, 6, 7, 8, 9]