dZ for sigmoid in linear_activation_backward

Sorry, but that is wrong. If we have:

A = sigmoid(Z)

Then

g'(Z) = A * (1 - A)

But you don’t really need that in order to compute dZ^{[L]}. They have you the shortcut that comes from that together with the formula for dA^{[L]}.

dZ^{[L]} = A^{[L]} - Y

Here’s another recent thread that may be worth a look.