Machine course 3 week 2 problem

can not find the distance please help me

1 Like

@Sudipta_Mukherjee1,
The screenshot you shared is a little confusing. The portion of the code it shows looks like you are defining a whole new function compute_ED_metod1(x) in the section where you should just be adding some code to the `sq_dist(a, b) function.

Maybe you have an implementation of sq_dist(a, b) above what is shown in the screenshot, but I also can’t see the error you’re getting because the screenshot cuts off the error portion without showing the whole error.

So I only have general suggestions for you at this point: For the sq_dist(a, b) function, you only need to add code to calculate the squared distance in the ### START CODE HERE ### section. You can click on the “Click for hints” link below the cell that calls test_sq_dist(sq_dist) for hints on how to do this.

Also: It is against community guidelines to share your solutions to assignments so please avoid sharing your code from the ### START CODE HERE ### … to ### END CODE HERE ### sections. You can share your error messages, though, and sharing the full error can be very helpful.


i have changed the code but nothing happened please help i am stuck with it

Hi, try without loops, with np.sum and np.square