• + 2 comments

    Ok, here is the explanation. The simple print(*arr[::-1]) is equivalent to:

    output_str = ""
    inverse_array = arr[::-1]
    for element in inverse_array:
        output_str = output_str + " " + str(element)
    print(output_str)
    

    This is why Python has it all.