our_list = [6, 2, 9, 0, 1, 2, 4] def swap(a, b): temp = our_list[a] our_list[a] = our_list[b] our_list[b] = temp print(our_list) done = False while not done : done = True for i in range(len(our_list)-1): if our_list[i] > our_list[i+1]: swap(i, i+1) done = False print(our_list)