input: from typing import List
  
  def transpose(A: List[List[int]]) -> List[List[int]]:
      """ Transposes a given 2D array and stores the result in a new array.
      >>> transpose([[1, 2, 3], [4, 5, 6]])
      [[1, 4], [2, 5], [3, 6]]
      >>> transpose([[1, 2], [3, 4], [5, 6]])
      [[1, 3, 5], [2, 4, 6]]
      """
output:     rows = len(A)
      cols = len(A[0])
      transposed = [[0 for _ in range(rows)] for _ in range(cols)]
      for i in range(rows):
          for j in range(cols):
              transposed[j][i] = A[i][j]
      return transposed