I want to swap two lists, one is empty and the other is full.
I am trying to insert element by element, and within the same for loop to empty the second list, is it possible to be done with one for loop?
What I have managed so far is:
def swap():
s1 = []
s2 = [1,4,7]
for i in range(0,len(s2)-1):
s1.append(s2[i])
s2.pop()
I know that it can be easily be done by:
def swap():
s1 = []
s2 = [1,4,7]
s1 = s2
s2 = []
It is for learning purposes