'( Python ) Can you swap the starting process of the selection sort?

from finding the minimun and put it on the left to finding the maximum and put it on the right

def SelectionSort(a_list):
    n = len(a_list)

    for i in range(0, n-1):
        iMin = i
        print(a_list)

        for j in range(i+1, n):
            if a_list[j] < a_list[iMin]:
                iMin = j

        temp = a_list[i]
        a_list[i] = a_list[iMin]
        a_list[iMin] = temp
    
    print()
    return a_list

someList = [45,984,6,90,8946,89]
SelectionSort(someList)

Can it swap the process from minimum => maximum to minimum <= maximum

the answer should look like this.

[6, 45, 89, 89, 984, 8946]



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source