When I move items from list "X" to anther list "A", but some items are missing.
Here is my code.
X=list(range(2,11))
print(X)
A=list()
for x in X:
A.append(x)
X.remove(x)
print("A is ", A)
print("X is ", X)
I expected X =[], A =[2,3,4,5,6,7,8,9,10],
but the result was
A is [2, 4, 6, 8, 10]
X is [3, 5, 7, 9]
the odd numbers aren't moved. I want to know why they are not moved and how to move them.
I'm new to python programing, and any help will be greatly appreciated.