input: Write a function to optimize a Python program that processes a 2d array and stores the transpose output in a new array. The function should take a 2D array A as input and return a new 2D array that is the transpose of A.
  assert transpose([[1, 2, 3], [4, 5, 6]])==[[1, 4], [2, 5], [3, 6]]
  assert transpose([[1, 2], [3, 4], [5, 6]])==[[1, 3, 5], [2, 4, 6]]
  assert transpose([[1]])==[[1]]
  assert transpose([[1, 2, 3, 4, 5, 6]])==[[1], [2], [3], [4], [5], [6]]
  assert transpose([])==[]
output: def transpose(A):
      if not A:
          return []
      return [[A[j][i] for j in range(len(A))] for i in range(len(A[0]))]