Course 4, Week 1, Assignment 1, Exercise 7

My final answer matches the expected value but I got assertion error…Does anyone know why?

AssertionError Traceback (most recent call last)
in
10 assert type(a) == np.ndarray, “Output must be a np.ndarray”
11 assert a.shape == (10, 10), f"Wrong shape {a.shape} != (10, 10)"
—> 12 assert np.sum(a) == 100, “Values must sum to 100”
13
14 print("\033[92m All tests passed.")

AssertionError: Values must sum to 100

Apparently the ‘a’ values don’t sum to 100.

1 Like

This is my code.
What should I do?

The average value should be:
average = dz / (n_H * n_W)

Then for ‘a’, you multply by average, not divide

1 Like

That’s right. Thank you!