Hi,

I am very much hoping someone can help me find the solution to the error I am getting.

I have attached a screenshot of the error.

Thank you so very much in advance.

Hi,

I am very much hoping someone can help me find the solution to the error I am getting.

I have attached a screenshot of the error.

Thank you so very much in advance.

1 Like

Every time you open the notebook, you have to run all of the cells starting from the top. Thatâs where all of the assets and packages are imported.

Thank you TMosh. I have tried that, but unfortunately error does not solve. Any other thoughts?

1 Like

I think if you run all the cells, it will solve that problem. There is evidence you have not run all of the cells:

- I see that you have âimport numpy as npâ at the startof this graded function.

Thatâs incorrect. That indicates you tried to run that cell without running all of the previous cells. Then you got an error and fixed it by adding an import there.

You donât need to import numpy there, because itâs imported in the first cell in the notebook.

- The test_sq_dist() function is in public_tests.py, which is imported from this cell in the notebook:

So if you run all of the cells every time you open the notebook, you will have all of the required assets.

1 Like

Hi Tmosh,

Thank you for the reply. I really appreciate it. I have removed the import numpy line and ran several times from top to bottom all the cells. I still get the error.

Of note, I did get all tests passed above and still get the error.

Any other thoughts on how to solve this ?

Thank you very much,

By looking at the screenshot, this time it throws an AssertionError, which indicates that there is a fault in your function `sq_dist()`

.

1 Like

Hi!

I have exactly the same problem. The squared distance are different than expectedâŚ

1 Like

I figured it out! The code is wrong. It should be:

{moderator edit: code removed}

@Karolina_Kopec ,

Glad you figured it out.

Please remove your code. Posting code is not allowed as per the community guidelines.

@Charlotte_Dandurand, note also that your results shown in the OP are incorrect.

Do the instructions tell you to use a square root function? The comments imply you should compute the âsquared distanceâ. That would be the sum of the squares. No square root.

Thank you. That was key !

1 Like

Hi, Iâm sorry, Iâm stuck in this activity, thatâs why all the codes are messed up, even the explanations of the questions are deleted, and the codes that worked before donât work now. How can I start everything from the beginning?

Thanks.

See the FAQ.

2 Likes

Hello again, I wrote the codes, even at the bottom of the answers, it says that the all tests passed, but I donât know why it doesnât give me a score. I also refreshed the device, but there is still no score in my grades section. Can anyone help me out?

Thanks

Passing the tests in the notebook do not prove your code is perfect.

The grader tests your code using different data and conditions.

What feedback do you get from the grader? Please post a screen capture image.

1 Like

okay thank you so much I corrected thanks:) I got my score thanks

Hi Karolina, could you give a hint how you solved it? Have the same issue as it was here, but you seemed to have solved it and then the discussion stopped.

Use np.sum() and np.square() of the differences.

Thanks, I had done that, but it only calculate a1 and b1 correctly and not a2/b2 and a3/b3.

What are are a1, a2, b1, and b2? The function weâre discussing only uses two vectors âaâ and âbâ.

1 Like