Unable to complete assignement 02 in Week 04 Course 01

I’m unable to complete this assignment since 2 weeks and I’m unable to figure out a way to complete this.It’s shows “Too many parameters to unpack” error.
Here’s a picture of what the issue looks like.
Thank you.
Hoping for a quick positive reply

Let’s start at the source. The ValueError exception being thrown is telling you that your two_layer_model function is returning more than the two values expected (to be designated as parameters and costs). Did you add an extra object to the return statement (the last line of the function)? I sometimes do this for diagnostic purposes and then forget to remove the added objects.

No I haven’t added any additional objects to the return statement.Here’s the code block and screenshot of the return statement.

(Moderator edit: code removed)

Sorry, I got that backwards. The call to the function, expects more objects (in the returned tuple object produced by the return statement). than it is receiving. The call to the function will assign the expected two objects in the tuple to variables parameters (a Python dict) and costs (a Python list). This is what is meant by “unpacking”.

So, have you removed an object from the return statement? The function calls for:
return parameters, costs .

As an (important!) side note, by agreeing to adhere to the Coursera honor code (you check a box in agreement), you are not allowed to post your code–in Discourse or other public venues. You are encouraged, however, to post your “traceback” (i.e. the error log). Human nature being what it is, it is tempting to other students to try out your code to arrive at an answer. That degrades their learning experience. So, thanks for your future adherence to the policy! :grinning:

I haven’t removed the return statement as well. It is the same. I’m still facing this issue. Could you please help out?


This thread was posted 2 years ago. The problem you have may not be the same. You will get a speedy response if you post a fresh query with error trace back to help with the diagnosis.