input: Write a function to sort a list using a selection sort algorithm. The function should return the sorted list.
  assert sort_list([1, 5, 7, 8, 4, 10, 2])==[1, 2, 4, 5, 7, 8, 10]
  assert sort_list([9, 3, 7, 5, 1])==[1, 3, 5, 7, 9]
  assert sort_list([])==[]
  assert sort_list([2, 2, 2, 1, 1, 1])==[1, 1, 1, 2, 2, 2]
  assert sort_list([10, -5, 0, 3, 1])==[-5, 0, 1, 3, 10]
output: def sort_list(arr):
      for i in range(len(arr)):
          min_idx = i
          for j in range(i+1, len(arr)):
              if arr[j] < arr[min_idx]:
                  min_idx = j
          arr[i], arr[min_idx] = arr[min_idx], arr[i]
      return arr