# Error with invalid syntax (Week 2 - "Python Basics with Numpy" e

**URL:** <https://community.deeplearning.ai/t/error-with-invalid-syntax-week-2-python-basics-with-numpy-e/132894>\
**Category:** Neural Networks and Deep Learning\
**Tags:** coursera-platform\
**Created:** [May 30, 2022, 3:57pm UTC](https://community.deeplearning.ai/t/error-with-invalid-syntax-week-2-python-basics-with-numpy-e/132894 "2022-05-30T15:57:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Patricio\_Ramirez\_Tor](https://avatars.discourse-cdn.com/v4/letter/p/e47c2d/32.png) [@Patricio\_Ramirez\_Tor](https://community.deeplearning.ai/u/Patricio_Ramirez_Tor)\
**Post date:** [May 30, 2022, 3:57pm UTC](https://community.deeplearning.ai/t/error-with-invalid-syntax-week-2-python-basics-with-numpy-e/132894/1 "2022-05-30T15:57:17Z")

</div>

_{moderator edit - solution code removed}_

I think my line of code is right but it says the “return” line is invalid, although that is the part that was given to me

---

<div class="post-metadata">

**Author:** ![MayankGhogale](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@MayankGhogale](https://community.deeplearning.ai/u/MayankGhogale)\
**Post date:** [May 30, 2022, 4:00pm UTC](https://community.deeplearning.ai/t/error-with-invalid-syntax-week-2-python-basics-with-numpy-e/132894/2 "2022-05-30T16:00:13Z")

</div>

Hello,  
Sir check your braces where you define the value of s  
I think you have 2 braces left unclosed

---

<div class="post-metadata">

**Author:** ![Patricio\_Ramirez\_Tor](https://avatars.discourse-cdn.com/v4/letter/p/e47c2d/32.png) [@Patricio\_Ramirez\_Tor](https://community.deeplearning.ai/u/Patricio_Ramirez_Tor)\
**Post date:** [May 30, 2022, 4:02pm UTC](https://community.deeplearning.ai/t/error-with-invalid-syntax-week-2-python-basics-with-numpy-e/132894/3 "2022-05-30T16:02:53Z")

</div>

Thanks problem was fixed

---

<div class="post-metadata">

**Author:** ![MayankGhogale](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@MayankGhogale](https://community.deeplearning.ai/u/MayankGhogale)\
**Post date:** [May 30, 2022, 4:03pm UTC](https://community.deeplearning.ai/t/error-with-invalid-syntax-week-2-python-basics-with-numpy-e/132894/4 "2022-05-30T16:03:21Z")

</div>

Hello,  
You are welcome sir

---

<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:** [May 30, 2022, 7:12pm UTC](https://community.deeplearning.ai/t/error-with-invalid-syntax-week-2-python-basics-with-numpy-e/132894/5 "2022-05-30T19:12:36Z")

</div>

And then you get to move to the next problem, which is infinite recursion. You are calling sigmoid from within the sigmoid function. That will not end well. It is effectively an infinite loop.

Also please note that it’s against the rules to just post your code and say, in effect, “Please fix it for me”. It’s fine to just post the exception trace that you get when you run the test. It shows a little bit of source code, but is generally enough for us to provide some debugging help.
