input: Write a python function to sort an array using selection sort.
  assert sort_array([7, 3, 1, 5, 2, 4]) == [1, 2, 3, 4, 5, 7]
  assert sort_array([10, 9, 8, 7, 6, 5]) == [5, 6, 7, 8, 9, 10]
  assert sort_array([1, 2, 3, 4, 5, 6]) == [1, 2, 3, 4, 5, 6]
output: def sort_array(arr):
      n = len(arr)
      for i in range(n):
          min_idx = i
          for j in range(i+1, n):
              if arr[j] < arr[min_idx]:
                  min_idx = j
          arr[i], arr[min_idx] = arr[min_idx], arr[i]
      return arr