# SyntaxError: invalid syntax

**URL:** <https://community.deeplearning.ai/t/syntaxerror-invalid-syntax/759164>\
**Category:** AI Discussions\
**Tags:** ai-discussions\
**Created:** [January 27, 2025, 1:51pm UTC](https://community.deeplearning.ai/t/syntaxerror-invalid-syntax/759164 "2025-01-27T13:51:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![1gee](https://avatars.discourse-cdn.com/v4/letter/1/4da419/32.png) [@1gee](https://community.deeplearning.ai/u/1gee)\
**Post date:** [January 27, 2025, 1:51pm UTC](https://community.deeplearning.ai/t/syntaxerror-invalid-syntax/759164/1 "2025-01-27T13:51:47Z")

</div>

Is there any Synatx error here? dw = (1 / m) \* np.dot(X, np(A-Y).T

---

<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:** [January 27, 2025, 2:24pm UTC](https://community.deeplearning.ai/t/syntaxerror-invalid-syntax/759164/2 "2025-01-27T14:24:38Z")

</div>

Yes, dw = (1 / m) \* np.dot(X, np(A-Y).T

What is the np(A-Y) doing here? Also you need to close np.dot()!

---

<div class="post-metadata">

**Author:** ![1gee](https://avatars.discourse-cdn.com/v4/letter/1/4da419/32.png) [@1gee](https://community.deeplearning.ai/u/1gee)\
**Post date:** [January 27, 2025, 3:08pm UTC](https://community.deeplearning.ai/t/syntaxerror-invalid-syntax/759164/3 "2025-01-27T15:08:53Z")

</div>

Thanks. I solved it.

---

<div class="post-metadata">

**Author:** ![TMosh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/tmosh/32/9321_2.png) [@TMosh](https://community.deeplearning.ai/u/TMosh)\
**Post date:** [January 27, 2025, 3:10pm UTC](https://community.deeplearning.ai/t/syntaxerror-invalid-syntax/759164/4 "2025-01-27T15:10:22Z")

</div>

Always count the sets of parenthesis.

---

<div class="post-metadata">

**Author:** ![paulinpaloalto](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/paulinpaloalto/32/187_2.png) [@paulinpaloalto](https://community.deeplearning.ai/u/paulinpaloalto)\
**Post date:** [January 27, 2025, 3:41pm UTC](https://community.deeplearning.ai/t/syntaxerror-invalid-syntax/759164/5 "2025-01-27T15:41:51Z")

</div>

Also note that the notebook editor is “syntax aware”: just click on a paren or bracket and it will highlight the matching one. Or not! 🙀
