input: Write a python function to implement the selection sort algorithm.
  assert selection_sort([10, 4, 6, 7, 2, 1]) == [1, 2, 4, 6, 7, 10]
  assert selection_sort([5, 3, 8, 4, 2]) == [2, 3, 4, 5, 8]
  assert selection_sort([20, 18, 12, 8, 5, -2]) == [-2, 5, 8, 12, 18, 20]
output: def selection_sort(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