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 its transposed version as a new 2D array B.
  assert transpose([[1,2,3],[4,5,6]])==[[1,4],[2,5],[3,6]]
  assert transpose([[1,2,3,4],[5,6,7,8],[9,10,11,12]])==[[1,5,9],[2,6,10],[3,7,11],[4,8,12]]
  assert transpose([[1]])==[[1]]
  assert transpose([[]])==[[]]
  assert transpose([[1,2,3],[4,5,6],[7,8,9]])==[[1,4,7],[2,5,8],[3,6,9]]
output: def transpose(A):
      return [[A[j][i] for j in range(len(A))] for i in range(len(A[0]))]