input: Write a function to demonstrate a sorting algorithm using the selection sort method. The function should return the sorted list. If the input list is empty, the function should return an empty list.
  assert sort_list([1, 5, 7, 8, 4, 10, 2])==[1, 2, 4, 5, 7, 8, 10]
  assert sort_list([9, 8, 7, 6, 5, 4, 3])==[3, 4, 5, 6, 7, 8, 9]
  assert sort_list([])==[]
  assert sort_list([1])==[1]
  assert sort_list([5, 3, 8, 6, 7, 2])==[2, 3, 5, 6, 7, 8]
output: def sort_list(arr):
      if not arr:
          return []
      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