Help me in solving DAA005 problem

My issue

i am getting a correct output if i press the submit button it is showing wrong answer :failed on hidden test case please give me the solution for this issue

My code

def selection_sort(arr, n):
    for i in range(n):
        min_val = arr[i]
        min_idx = i
        for j in range(i + 1, n):
            if min_val > arr[j]:
                min_idx = arr[j]
                min_idx = j
        arr[i], arr[min_idx] = arr[min_idx], arr[i]

if __name__ == "__main__":
    n = int(input())

    arr = [int(x) for x in input().split()]

    selection_sort(arr, n)

    for i in range(n):
        print(arr[i], end=" ")

    print()

Learning course: Analysis and Design of Algorithms
Problem Link: Selection Sort in Analysis and Design of Algorithms