in python below is how you swap 2 elements of list x[i+1],x[i]=x[i],x[i+1] Don't use function swap(user defined or pre-defined)