In my current code of nested while loops, I have a statement to reload the tempSequence variable equal to the original sequence variable. However, through print-checking, you can see del(tempSequence[i]) is removing the value from both the tempSquence and sequence variables. I don't understand why the parent sequence is being affected in this way.
I have tried storing the sequence variable within the beginning of the outer loop, adding a new list inside the loop to store the original data, as well as moving the tempSequence = sequence statement multiple places throughout the code.
The easy way --> Repl.it link
The other way:
while i <= len(sequence):
tempSequence = sequence **<<<< this doesn't work but**
del(tempSequence[i])
print(sequence)
print(tempSequence)
j = 0 **<<<< This works every loop**
The expected result would be for tempSequence to be reset equal to the original array. Then altered and iterated.
The actual result leaves the array short one value each iteration, ending with a too short range to complete all iterations