Zig Zag Sequence

  • + 1 comment
    def findZigZagSequence(a, n):
        a.sort()
        mid = n//2
        a[mid], a[n-1] = a[n-1], a[mid]
    
        st = mid + 1
        ed = n - 2
        while(st <= ed):
            a[st], a[ed] = a[ed], a[st]
            st = st + 1
            ed = ed - 1
    
        for i in range (n):
            if i == n-1:
                print(a[i])
            else:
                print(a[i], end = ' ')
        return
    
    test_cases = int(input())
    for cs in range (test_cases):
        n = int(input())
        a = list(map(int, input().split()))
        findZigZagSequence(a, n)
    `
    
    This python solutions is Success. but I feel it's wrong answer.(line 3:` mid // 2`  Doesn't meet prerequisites)