input: from typing import List
  
  def transpose(A: List[List[float]]) -> List[List[float]]:
      """
      Transposes a given 2D array A and stores the result in a new array B.
  
      >>> transpose([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]])
      [[1.0, 4.0], [2.0, 5.0], [3.0, 6.0]]
      >>> transpose([[1, 2, 3], [4, 5, 6]])
      [[1, 4], [2, 5], [3, 6]]
      """
output:     rows = len(A)
      cols = len(A[0])
      B = [[0.0] * rows for _ in range(cols)]
      for i in range(rows):
          for j in range(cols):
              B[j][i] = A[i][j]
      return B