I wanted a separate list of 2 and 3 from an input list. for 1 1 2 2 3 3 4 4 as input I want to have [1,1,4,4] and [2,2,3,3] as outputs. But I am getting [1,1,2,3,4,4] and [2,3] instead. What is the problem with my code?
n = [int(x) for x in input().split()]
print(n)
K = []
for i in n:
    if i == 2 or i == 3:
        K.append(i)
        n.remove(i)
print(K)
print(n)
 
     
     
    