def swap(array, i, j):
    temp = array[i]
    array[i] = array[j]
    array[j] = temp
        
def index_of_min(array, start_index):
    min_value = array[start_index]
    min_index = start_index
    i = min_index + 1
    while i < len(array):
        if array[i] < min_value:
            min_value = array[i]
            min_index = i
        i += 1
    return min_index
        
def select_sort(array):    
    for i,_ in enumerate(array):
        j = index_of_min(array, i)
        swap(array, i, j)  

array = [5,2,1,4,3]
print(array)
select_sort(array)
print(array)

        

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: