please help me with the last exercise, i followed instructions but there are gaps unknown

Your code for a_slice_prev is not correct. Needs to include ‘c’ instead of a colon.

Your code for dA_prev is not correct.

- it needs to have four indices, you only have three.
- dA needs to specify all four indices, not use colons.

There’s a problem with some of your index values.

Well, notice a few things about your answers in the average case:

- They bear no resemblance to the correct values and are much larger in absolute value and are all positive. The correct values are both positive and negative.
- Your values are the same across each row, which is not true of the correct answers.

So that suggests that there are probably at least two problems:

The average value that you are adding is too large, so perhaps your `distribute_value`

code is wrong? E.g. did you forget to divide by the scaling factor?

You are not applying the values correctly somehow: you should be adding the average value (which is the same in every location) to the existing values with a += operation. So the only way the rows can come out the same is if you are somehow broadcasting across the rows and maybe doing = instead of += or something like that. If you start with all different values in the target matrix, how can doing += with the same RHS value in all positions create that case of it being equal across each row? Check the shapes of the RHS and LHS expressions. It’s an easily provable theorem that if a \neq b then a + c \neq b + c for any c \in \mathbb{R}, right? The analogous assertion would of course not true for multiplication because of the magic properties of 0.