def selectionsort(A):
    for i in range(len(A)-1):
        pos = 1
        for j in range(i+1, len(A)): 
          if(A[pos] > A[j]) :
              pos= j 
    A[i], A[pos] = A[pos], A[i]
    return (A)
A = [5, 1, 6, 9, 2, 7, 3]
A= selectionsort (A)
print("Sorted list: ",A)

Embed on website

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