Course 1, Week 2, Exercise 5 Assertion Error

In calculating dw, I have tried several ways, but get different error messages (only one of which gives me information about the error that I know how to debug):

dw = np.mean(X * (A - Y))

AssertionError                            Traceback (most recent call last)
<ipython-input-35-7cd89fb9dcd2> in <module>
      5 grads, cost = propagate(w, b, X, Y)
      6 
----> 7 assert type(grads["dw"]) == np.ndarray
      8 assert grads["dw"].shape == (2, 1)
      9 assert type(grads["db"]) == np.float64


dw = np.mean(X * (A - Y).T)

ValueError                                Traceback (most recent call last)
<ipython-input-37-7cd89fb9dcd2> in <module>
      3 X = np.array([[1., -2., -1.], [3., 0.5, -3.2]])
      4 Y = np.array([[1, 1, 0]])
----> 5 grads, cost = propagate(w, b, X, Y)
      6 
      7 assert type(grads["dw"]) == np.ndarray

<ipython-input-36-cc859cb3d1f3> in propagate(w, b, X, Y)
     43 
     44     #dw = np.mean(X * (A - Y))
---> 45     dw = np.mean(X * (A - Y).T)
     46     #dw = np.mean(np.dot(X, (A-Y).T))
     47     db = np.mean(A - Y)

ValueError: operands could not be broadcast together with shapes (2,3) (3,1) 


dw = np.mean(np.dot(X, (A-Y).T))

AssertionError                            Traceback (most recent call last)
<ipython-input-39-7cd89fb9dcd2> in <module>
      5 grads, cost = propagate(w, b, X, Y)
      6 
----> 7 assert type(grads["dw"]) == np.ndarray
      8 assert grads["dw"].shape == (2, 1)
      9 assert type(grads["db"]) == np.float64

AssertionError:

Any help appreciated!