I can't modify

Hello Volks,

Unfortunately, I couldn’t modify the number of iterations (num of iteration =2) in the assignment and always have errors when running the cell.
I want to modify it to be 2499 but I can’t ?, any solution, please?
Deep Learning Specialization week-4 Neural Networks and Deep Learning

1 Like

@Salman_Mohammed (?)

The cell should be editable–

You can change the number of iterations adjusting the argument (num_iterations) in the function header line:

# GRADED FUNCTION: two_layer_model

def two_layer_model(X, Y, layers_dims, learning_rate = 0.0075, num_iterations = 3000, print_cost=False):

Don’t try to mess with it within the function.

Further, can you post the error(s) you are getting ?

** Correction: Okay, I see now. But changing num_iterations = 2 – that is in the test, which you cannot change. In this case it is overriding the value of the default two_layer_model num_iterations = 3000 value.

So this probably just means you have a mistake somewhere in your function.

Again, posting the error result you recieve would help.


Thank you,
My main problem is not in the cell above where I can modify it, the problem is in the down cell I can’t modify the number of iterations, it is always 2 and the cell is unchangeable!!

and here is the error message

thank you in advance.

1 Like

It is expecting two return values:

return parameters, costs

Either you changed something you shouldn’t have and returned more, or recheck your code for how you calc/assemble parameters and costs.


That has nothing to do with the number of iterations. It is the number of return values your function is returning. That probably means you copied a very old version of that notebook (pre-April 2021) and they have changed the definition of that function.

It is a bad idea to copy old code off the internet a) because it’s cheating and you don’t really learn anything and b) because it doesn’t work if the code is old.

I suggest you rename your notebook, get a clean copy and then start over. You may be able to salvage some of your previous “work”, but you need to be careful to respect the template code they give you. You can’t just “copy/paste” over the whole function without looking.


I’m also highly confused about all of the “Submit this notebook for grading” buttons at the top of the page. That isn’t right.