I am trying to remove all the items from list2 into list1 like this:
l1 = [1, 2, 3]
l2 = [4, 5, 6]
for item in l2:
l1.append(item)
l2.remove(item)
the problem is:
#l1 now returns [1, 2, 3, 4, 6]
#l2 now returns [5]
I want it so that:
#l1 returns [1, 2, 3, 4, 5, 6]
#l2 returns []
Why does this happen? And what is the conventional way to achieve what I'm trying to do, in Python?