Course 2, Week 4 Lab - Right w/ Errors


I’ve been wracking my brain trouble shooting the last three assignments in the Practice Lab.

They give the right answers, but don’t like how I answered it. Problematc syntax.

I have screen shot all three of the incidents.

Screen Shot 2022-08-29 at 7.53.34 PM
Screen Shot 2022-08-29 at 7.53.52 PM
Screen Shot 2022-08-29 at 7.54.08 PM

Any suggestions for focus would be great! Thanks!


First issue, your code must provide a way to return 0 if len(y) == 0.

That avoids the problem of your code skipping line 21, which then throws an error in line 22.

The key item in the instructions is here next to the red arrow I added: