I did one simple code to separate elements of an array into two new arrays : one with odd numbers and other with even numbers. So I did this:
V=[1,2,3,4,5,6]
vp=[]
vi=[]
for x in V:
if x%2==0:
vp.append(x)
V.remove(x)
else:
vi.append(x)
V.remove(x)
print (V)
print (vp)
print (vi) # sorry for the bad identation first time sharing code here
and this code give me this result:
[2,4,6]
[]
[1,3,5]
How is it happen? How am I fix this?