input: Write a function to transpose a given 2D array and store the output in a new array. If the input array is empty, return an empty list.
  def transpose(A):
   n = len(A)
   if n == 0:
    return []
   m = len(A[0])
   B = [[0 for x in range(n)] for x in range(m)]
   for i in range(n):
    for j in range(m):
     B[j][i] = A[i][j]
   return B
  assert transpose([[1, 2, 3],[4, 5, 6]])==[[1, 4], [2, 5], [3, 6]]
  assert transpose([])==[]
  assert transpose([[1],[2],[3]])==[[1, 2, 3]]
  assert transpose([[1, 2, 3],[4, 5, 6],[7, 8, 9]])==[[1, 4, 7], [2, 5, 8], [3, 6, 9]]
  assert transpose([[1, 4],[2, 5],[3, 6]])==[[1, 2, 3], [4, 5, 6]]
output: def transpose(A):
      n = len(A)
      if n == 0:
          return []
      m = len(A[0])
      B = [[0 for x in range(n)] for x in range(m)]
      for i in range(n):
          for j in range(m):
              B[j][i] = A[i][j]
      return B