Program to implement Selection Sort

def selection_sort(arr):
    for i in range(len(arr)):
        min_index = min(range(i, len(arr)), key=arr.__getitem__)
        arr[i], arr[min_index] = arr[min_index], arr[i]
    return arr

arr = list(map(int, input("Enter numbers: ").split())) # input: 9 8 7 6 5 4 3 2 1
print("Sorted Array:", selection_sort(arr))