C3_W3 final lab issue - loss function

Hi there, I am unable to get my lab passed on the loss function. Unable to understand why it is wrong…

# moderator edit: code removed

I managed to resolve the issue by using just one line of code. However, the concepts is still a little bit confused.

Please don’t post your code on the forum. That’s not allowed by the community standard.

The key information that allows you do do this in one line of code is in the hint for Exercise 2 regarding the (1 - done_vals) factor.

When done_vals is 1, then 1-1 = 0, and the second term will be multiplied by 0. So it vanishes.