1 2 3 4 5 6 7 8 9 10 11
| def select_sort(): a_list = [2, 5, 7, 1, 4, 3, 6, 9, 8, 0] if a_list: for i in range(len(a_list)): min_index = i for j in range(i + 1, len(a_list)): if a_list[min_index] > a_list[j]: min_index = j a_list[min_index], a_list[i] = a_list[i], a_list[min_index] print(a_list) return a_list
|