I have a single large list and I want to append half the list to list1 and list2 while popping the items from the original list at the same time.
mylist = [1, 2, 3, 4, 5, 6, 7, 8]
list1 = []
list2 = []
for item in mylist:
list1.append(mylist.pop())
list2.append(mylist.pop())
list1
[8, 6, 4]
list2
[7, 5, 3]
Why is it not going through the entire list in mylist? If I increase the list size by adding items it will also append/pop more items to the other lists, but still never completely goes through the entire list.
Again, I'm trying to get half the original list into list1 and the other half of the original list into list2.