Week 3 assignment problem

stuck with assignment problem name error found please help assignment


Can you rerun all the code cells from the beginning?

This can be necessary after leaving the page and coming back. This is because the notebook is shutdown and then restarted after returning.

I have did this but nothing happened

no one is helping please help me to solve the assignment

I would have made the same suggestion as Sam did for the error you shared here. I have two yes/no questions for you:

  1. Go to the notebook, can you see this code cell under section 1, including these import lines?
    Screenshot from 2022-08-25 11-01-02

  2. On the jupyter notebook menu bar, click โ€œKernelโ€ > โ€œRestart and run allโ€, my question is, do you see the same error?


yes i have done but nothing happened

1 Like

I canโ€™t understand anything very tough

I have 4 suggestions for you.

  1. Download a fresh copy of the assignment, because from your screenshot, you have modified codes you are not supposed to. In each assignment, there are exercises and you only need to add codes in between this line ### START CODE HERE ### and this line ### END SOLUTION ###, and modify nothing else. To download a new copy, follow these instructions which will ask you to rename your current notebook before the system can get you a new copy. After this, you can copy your work from the original notebook to the exercise cells and in between the two lines mentioned above. Change nothing else. With this, I hope you can have a better and more solid notebook to continue your work.

  2. Understand how jupyter notebook works on coursera. Everytime you reopen the notebook, you need to re-run all the code cells from the very first one. If you do not re-run them, you will see the name XXX is not defined error which you shared in your first post of this thread.

  3. Read the error message and debug. The error messages you shared are actually quite easy to understand, and should give you the direction for you to start debugging. it is really not nothing.

  4. Learn Python first if you think writing code, understanding code, or debugging code is challenging. I suggest you to spend a few minutes to read this post on where you can start learning Python.

Lastly, it takes time to learn Python, to learn using jupyter notebook, and to debug your code, but this is a process each learner has to go through themselves.


i am stuck with it now please help

Hi, you need to indent your code correctly. I suggest you to spend a few minutes to read this post, and make changes to your code for indentation. Also, you have 3 code lines starting with z_wb, and I suppose the first one is not intended to be there and please remove it.


PS: we canโ€™t share assignment code here, so I am removing it.

now this problem are showing please help very hard i have run the previous shells but nothing happened

please help ayone i am stuck with it for whole day


The code in your function is not indented correctly.

I will also suggest the W3Schools tutorial for getting familiar with Python as a programming language.

how to fix it it? what to do now?

i have done the code as instructed

Hello there,

your code is not indented correctly, search google for indenting python and try to learn a little bit about it, your code is technically right, but itโ€™s outside the function:

if you want to indent something inside this function:
<\tab> then
<\tab> it
<\tab> must
<\tab> be
<\tab> indented
<\tab> correctly (using tab)
return: got it?

1 Like

now i got other result please help

please help anyone no one is helping

People are trying to help, but the way you ask for help isnโ€™t very politeโ€ฆ

You are having trouble cause you are not implementing the function correctly. I am happy that you indented the function correctly.

Now for you issue:
Take a look on the description of the exercise, itโ€™s very well explained:
Total Costโ€“> ๐ฝ(๐ฐ,๐‘)=1๐‘šโˆ‘๐‘–=0๐‘šโˆ’1[๐‘™๐‘œ๐‘ ๐‘ (๐‘“๐ฐ,๐‘(๐ฑ(๐‘–)),๐‘ฆ(๐‘–))

Check the indexes, Andrew Ng explained it very well, here you just need the index from the train data (i) you still donโ€™t need j.

for i in range(m):
<\tab>z_wb = np.dot(w , X[i]) + b
<\tab>f_wb = sigmoid (z_wb)
โ€ฆ the rest should be right.

How about that?

For the future, write you question clearly, instead of writing help,pls help, help.


My values of total cost are not matching with the expected , could anyone please check my code and evaluate what Iโ€™m doing wrong?


sir again the total cost are not matching the expected but i have written the code as instructed