I have written the following while loop:
nums = [1,2,3]
permutation_set = []
pointer_stand = 0
pointer_runner = 0
original_nums = nums[:]
permutation_set.append(original_nums)
while pointer_runner < len(nums)-1:
pointer_runner +=1
nums[pointer_stand], nums[pointer_runner] = nums[pointer_runner], nums[pointer_stand]
permutation_set.append(nums)
nums = original_nums
print(permutation_set)
The output to me makes no sense at all- I get [[3,2,1],[2,1,3],[3,2,1]]. But shouldn't the first list be simply [1,2,3]? If I remove the while loop completely, then my output is [1,2,3], so my question is, why is the while loop changing the first list? Especially since I DO NOT make any changes to 'original_nums'