def find_min_in_sublist(list, start): smallest = start for j in range(start, len(list)): if list[j] < list[smallest]: smallest = j return smallest def selection_sort(the_list): n = len(the_list) # makes it easy to denote the length of the list for i in range(n - 1): smallest = find_min_in_sublist(the_list, i) # Swap the values at index i and smallest. temp = the_list[i] the_list[i] = the_list[smallest] the_list[smallest] = temp grade_list = [89, 45, 85, 81, 77, 94, 22, 79, 92, 91] selection_sort(grade_list) print("grade_list after sorting: " + str(grade_list) )