def findSmallest(arr):
    smallest = arr[0]
    smallest_index = 0
    for i in range(1, len(arr)):
        if arr[i] < smallest:
            smallest = arr[i]
            smallest_index = i
    return smallest_index


def selection_sort(arr):
    newarr = []
    for i in range(len(arr)):
        smallest_index = findSmallest(arr)
        newarr.append(arr.pop(smallest_index))
    return newarr

test_arr = [5, 3, 6, 1, 0, 0, 2, 10]
print(selection_sort(test_arr))

def findSmallest(arr):
    smallest = arr[0]
    smallest_index = 0
    for i in range(1, len(arr)):
        if arr[i] < smallest:
            smallest = arr[i]
            smallest_index = i
    return smallest_index


def selection_sort(arr):
    newarr = []
    for i in range(len(arr)):
        smallest_index = findSmallest(arr)
        newarr.append(arr.pop(smallest_index))
    return newarr

test_arr = [5, 3, 6, 1, 0, 0, 2, 10]
print(selection_sort(test_arr))
