def selectSort(lists): count=len(lists) for i in range(0,count): for j in range(i+1, count): if lists[i] > lists[j]: lists[i] , lists[j] = lists[j] , lists[i] print(lists) L = [51,6,21,31,15,42,16,75,51] selectSort(L)
def selectSort(lists): count=len(lists) for i in range(0,count): for j in range(i+1, count): if lists[i] > lists[j]: lists[i] , lists[j] = lists[j] , lists[i] print(lists) L = [51,6,21,31,15,42,16,75,51] selectSort(L)