This is the code I've written for a Python program (please keep in mind that I learnt Python from the Internet a couple of days ago). It is supposed to rearrange a inputted list (say, [3,2,4,1,5]), into, in the example case, [1,2,3,4,5]. For some reason, it's not working, and I can't figure the reason out. I've tried many different ways to do it, but none is working. In this case, the program returns the same value as the original one. Here's the code:
#General purpose string solver (by 2swapping + sune combos)
def solvepermutation():
#Setup
global pos
pos = raw_input('Ingrese permutacion.\n')
orientation = raw_input('Ingrese orientacion.\n')
#Generating solved position
solved=[]
for i in range(len(pos)):
solved.append(int(i+1))
#Solving pos
solvepos()
#Printing pos solved
print(pos)
#Function which solves pos
def solvepos():
global pos
for z in range(len(pos)-1):
for q in range(len(pos)):
if pos[z] == q+1:
pos[z],pos[q]=pos[q],pos[z]
continue
else:
continue