A = [1,1,4,5,1,4] for _ in range(len(A)): p = 1 while p < len(A): if A[p] < A[p - 1]: a = A[p] A[p] = A[p - 1] A[p-1] = a p+=1 print(A)
To embed this project on your website, copy the following code and paste it into your website's HTML: