<doocs>0832.Flipping an Image_1.py
def flipAndInvertImage( A: List[List[int]]) -> List[List[int]]:
    m, n = len(A), len(A[0])
    for i in range(m):
        p, q = 0, n - 1
        while p < q:
            t = A[i][p] ^ 1
            A[i][p] = A[i][q] ^ 1
            A[i][q] = t
            p += 1
            q -= 1
        if p == q:
            A[i][p] ^= 1
    return A
def sample_funcname ( var_0 : List [ List [ int ] ] ) -> List [ List [ int ] ] :
    var_4 , var_6 = len ( var_0 ) , len ( var_0 [ 0 ] )
    for var_8 in range ( var_4 ) :
        var_9 , var_11 = 0 , var_6 - 1
        while var_9 < var_11 :
            var_12 = var_0 [ var_8 ] [ var_9 ] ^ 1
            var_0 [ var_8 ] [ var_9 ] = var_0 [ var_8 ] [ var_11 ] ^ 1
            var_0 [ var_8 ] [ var_11 ] = var_12
            var_9 += 1
            var_11 -= 1
        if var_9 == var_11 :
            var_0 [ var_8 ] [ var_9 ] ^= 1
    return var_0
