input: Write a function to implement a sorting algorithm and return the sorted list. If the given list is empty, return an empty list. The function should use selection sort to achieve this.
  def sort_list(mylist):
   for i in range(len(mylist)):
    min_index = i
    temp = mylist[i]
    for j in range(i + 1, len(mylist)):
     if mylist[min_index] > mylist[j]:
      min_index = j
    mylist[i] = mylist[min_index]
    mylist[min_index] = temp
   return mylist
  assert sort_list([1, 5, 7, 8, 4, 10, 2])==[1, 2, 4, 5, 7, 8, 10]
  assert sort_list([10, 9, 8, 7, 6, 5, 4, 3, 2, 1])==[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
  assert sort_list([])==[]
  assert sort_list([5, 4, 3, 2, 1])==[1, 2, 3, 4, 5]
  assert sort_list([1])==[1]
output: def sort_list(mylist):
      for i in range(len(mylist)):
          min_index = i
          for j in range(i + 1, len(mylist)):
              if mylist[min_index] > mylist[j]:
                  min_index = j
          mylist[i], mylist[min_index] = mylist[min_index], mylist[i]
      return mylist