C3_W2_Square distance Ex:1

After solving the Square distance problem in 3 different ways ,each time I got 50% mark and the following message :Code Cell UNQ_C2 failed: sq_dist test 2 failed .
“If you see many functions being marked as incorrect, try to trace back your steps & identify if there is an incorrect function that is being used in other steps.
This dependency may be the cause of the errors.”

I think my defining a and b are wrong
1st time:
a = np.random.rand(10)
b = np.random.rand(10)
d =
return d

2nd time:
a= np.array((1,2,3))
b= np.array((4,5,6))
d =
return d
3rd time:
Without define a and b I wrote square distance formula with a and b
since def sq_dist(a,b):
return d

How can I fix the problem?

Hello @sujon.buet,

When you implement the sq_dist function, a and b are provided as input parameters, so if you had defined them inside your sq_dist function, you need to remove them.


I’m also not able to solve this any help would be appreciated

Learner should have solved the problem