C2_W1_Assignment : I have an issus when i execute the cell it produces the expected output however when i run the test cell it generates an error, how can i solve it

This assignment was just updated. The update changes the number of arguments used by this function, and it updated the test utility file.

You have the newest unit test function (which is in the utility file), but you still have the old notebook.

Please try updating to the newest version of the notebook.

I appreciate your assistance, and I’m currently facing an error after incorporating the two arguments you suggested in the image.

It looks like you modified the provided code that defines the function L_of_omega_array().

You added “=prices_A” and “=prices_B” to the function definition. See below where I marked with X’s. You also modified pB to become “PB”

Please do not do that. Nothing in that line of code needs to be modified. Please restore the original code:
def L_of_omega_array(omega_array, pA, pB):

The only place you should make changes is between the comments labeled “START CODE HERE” and “END CODE HERE”

The code you need to supply is given by the template code:

        L = None(None[None], None, None)
        L_array = L_array.at[None].set(None)

For the first line, you replace “None” with some function name, and provide it three parameters, separated by commas.

For the second line, you replace the first None with some index, and the second “None” with some value.

‘’‘L_array = L_of_omega_array(omega_array)’‘’
if i add argument pA and pB what is the number i add to them when i call the function

The line of code I marked with an arrow is incorrect. The template code has two additional arguments - pA and bB.
Those are what you pass to L_of_omega() as the 2nd and 3rd parameters.
That’s why your call to L_of_omega(…) is also incorrect. It should have 3 parameters. You provided only one.

A few posts back, I recommended that you update your notebook to the current version.
Did you do that? Because if you did, then L_of_omega_array(…) would look like this:

“Thank you. I solved it, and all tests passed, but when I submitted the assignment, I got zero! How can I solve this?”

Click on the > next to the grader feedback, and you’ll get a message about why your code scored 0 points.

There are still problems in your code:

Don’t use prices_A and prices_B. Those are global variables. That’s a bad practice.
Use the parameters pA and pB. That’s why they are in the function definition.

i did that and still the same problem

OK, that’s looking better.

Here is the next thing to check.

  • Go to the View menu
  • Click on Cell Toolbar, and then select “Edit Metadata”

Now your notebook will look like this:

Click on the “Edit Metadata” button.

It should look like this:

Please post a screen capture image that shows your Metadata for the f_of_omega(…) cell.

Then click on “Cancel”, then go back to “View” and in “Cell Toolbar” select “None”.

1 Like

OK, that cell is missing the “graded” tag, so that’s why the grader can’t find it in your notebook.
I’m not sure how this issue happens, you’re the 2nd person person who has reported this issue. Somehow the metadata for that cell has been altered.

The easiest fix is for you to edit the metadata field so it matches what I posted. You can edit it right there in the “Edit Cell Metadata” window.

Then save the changes (by pressing “Edit”), and submit your notebook to the grader again.

Thank you, I made it, and it works

1 Like

That’s great news!