# Unq\_c2 mls course 3 week 3 excercise 2 assignment

**URL:** <https://community.deeplearning.ai/t/unq-c2-mls-course-3-week-3-excercise-2-assignment/229446>\
**Category:** Unsupervised Learning, Recommenders, Reinforcement\
**Tags:** week-module-2\
**Created:** [November 11, 2022, 9:46am UTC](https://community.deeplearning.ai/t/unq-c2-mls-course-3-week-3-excercise-2-assignment/229446 "2022-11-11T09:46:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Onuorah\_Martins\_Onye](https://avatars.discourse-cdn.com/v4/letter/o/c5a1d2/32.png) [@Onuorah\_Martins\_Onye](https://community.deeplearning.ai/u/Onuorah_Martins_Onye)\
**Post date:** [November 11, 2022, 9:46am UTC](https://community.deeplearning.ai/t/unq-c2-mls-course-3-week-3-excercise-2-assignment/229446/1 "2022-11-11T09:46:07Z")

</div>

# GRADED\_FUNCTION: sq\_dist

# UNQ\_C2

def sq\_dist(a,b):  
“”"  
Returns the squared distance between two vectors  
Args:  
a (ndarray (n,)): vector with n features  
b (ndarray (n,)): vector with n features  
Returns:  
d (float) : distance  
“”"  
### START CODE HERE ###  
d = np.sum(np.square(a-b)  
### END CODE HERE ###  
return d  
I got the error below.  
File “”, line 15  
return d  
^  
SyntaxError: invalid syntax

I need your help please my mentors

---

<div class="post-metadata">

**Author:** ![gent.spah](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/gent.spah/32/136423_2.png) [@gent.spah](https://community.deeplearning.ai/u/gent.spah)\
**Post date:** [November 11, 2022, 10:05am UTC](https://community.deeplearning.ai/t/unq-c2-mls-course-3-week-3-excercise-2-assignment/229446/2 "2022-11-11T10:05:30Z")

</div>

> [@Onuorah\_Martins\_Onye](#):
>
> np.sum(np.square(a-b)

Dont you need to close the np.sum with another ending bracket.

---

<div class="post-metadata">

**Author:** ![Onuorah\_Martins\_Onye](https://avatars.discourse-cdn.com/v4/letter/o/c5a1d2/32.png) [@Onuorah\_Martins\_Onye](https://community.deeplearning.ai/u/Onuorah_Martins_Onye)\
**Post date:** [November 11, 2022, 10:14am UTC](https://community.deeplearning.ai/t/unq-c2-mls-course-3-week-3-excercise-2-assignment/229446/3 "2022-11-11T10:14:12Z")

</div>

Thanks my Mentor gent.spah
