While I was able to compute the Square Distance values (image given below), I am getting an “out of bounds” error in the check script…
I think you have hard-coded the squared difference in the function sq_dist
.
Your code fails to access the third element when an array of only two elements is passed at line 31.
Utilize the loop’s advantage and avoid explicit indexing.
You should write your code so it works for any number of features.
Spot on! For loop with an additional len input took care of array length issue. Thanks