Week 2 Assignment 3 and 4

# (≈ 1 line of code)
# s = 
# YOUR CODE STARTS HERE
s = 1 / [1 + math.exp(-1*x)] 

# YOUR CODE ENDS HERE

return s

I am stuck at this basic error. Can someone point out what am i doing wrong?

That means either you did not actually execute the basic_sigmoid cell or else there was a syntax error when you did that. Just typing code doesn’t do anything until you click “Shift-Enter” on that cell. I’m a little bit worried about those square brackets in the denominator of your sigmoid code. I think that will probably either throw a syntax error or at least not work correctly. I suggest using parentheses instead.

Thank you so much. It worked like wonders after exchange of square brackets with parentheses.

Great! It’s important to know your python syntax. When you use square brackets in python, that makes the contents a “list”, which is a specific python datatype. That is why using square brackets there causes an error. Using parentheses is just a way to control the order of operations.

Appreciate your insights Paul. Noted for further assignments!