Week 1, Practice Lab 1 -> Distance (Or distance squared?)

For exercise 1 in the lab, the solution takes the distance between each point and the centroid.
I thought we are supposed to take the squared distance, as it shows in the formula the squared distance.
Am I missing something? Thank you!

Hello @m7a,

Both distance and distance squared should get you the same result. Did they not get you the same result, or were you trying to point out some inconsistent descriptions within the notebooks? If it is the latter, would you mind sharing where and where are inconsistent?


Hi Raymond, they give the same result, and you are correct I was just trying to point out the inconsistency. The lecture videos teach to take the squared distances, as well, the formula right above the code cell shows to use the squared distances. Was just wondering why use squared distances if we don’t have to

Hello @m7a,

You said both are using squared distances, but where would the inconsistency be? For example, in the assignment, I think you are referring to the following formula in Exercise 1.1:


Can you share at which timestamp in which video did it mention to use distance? Or which part of the assignment said to use distance?

I understand this. However, did the autograder fail your submission, or were you unable to pass any tests because of using squared distance or using distance? If so, please share the details; otherwise, you don’t have to, right? :wink:

In some cases, we ask learners to use a specific way because the autograder can’t judge like a human. For this assignment, perhaps I am wrong, but I do not think you have to use squared distance instead of distance.

I will think about what improvement we can make if you provide me the sources (video name + which timestamp, or assignment section number + which sentence).