With below code, I was expecting to swap two lists and was expecting all the elements from 'names' list to 'Excluded_list'using Pop() function. But it is not working expectedly, can someone please tell the issue with below code ??
names=['Ram','Sham','Mohan','John','Kuldeep']
Excluded_list=[]
print('names list',names)
print('Excluded list ',Excluded_list)
Code to swap/reprint lists
for name in names:
Excluded_list.append(names.pop())
print('names list',names)
print('Excluded list ',Excluded_list)