The variable 'operations' which is a list is changing after the for loop is run despite their being no line that explicitly says for its value to change. Here is my code:
validOperations = ['(', ')', '^', '*', '/', '+', '-']
operations = ['+', '*', '/']
newOp = operations
for y in range(len(newOp) - 1):
for z in range(len(newOp) - 1):
if(validOperations.index(newOp[z]) > validOperations.index(newOp[z+1])):
oldVal = newOp[z]
newOp[z] = newOp[z+1]
newOp[z+1] = newOp[z]
print(newOp)
print(operations)
What can I do to make it to where the value of operations stays constant?