I want that for
loop iterates the number of times, there are items
in my_list
, and correspondingly during each execution pops
the items
out of my_list
and add them in purchase_list
, until all the elements of my_list
are popped and appended into the purchase_list
. But it doesn't happen. Why?
my_list = ['pen' , 'pencil' , 'cell phone' , 'axiom team' , 'panacloud' ]
purchase_list = []
for items in my_list:
purchase_item = my_list.pop()
purchase_list.append(purchase_item)
print(purchase_list)
Output is as follows:
['panacloud', 'axiom team', 'cell phone']