# Week 2 Practice Programming

Hi,
For week 2 Practice Exercises - every exercise has a functionName_test.
Can you suggest what should i do with this function? When I run, it shows error.

For example, Exercise 3:- WHAT SHOULD I WRITE IN MY CODE TO EXECUTE sigmiod_test (sigmoid)???

t_x = np.array([1, 2, 3])
print("sigmoid(t_x) = " + str(sigmoid(t_x)))

sigmoid_test(sigmoid)

def sigmoid(x):

``````# (≈ 1 line of code)
# s =
s=np.exp(x)

return s``````

Hi, you should just write the `sigmoid` function, then you can execute the following cell which contains:

``````print ("sigmoid([0, 2]) = " + str(sigmoid(np.array([0,2]))))
sigmoid_test(sigmoid)
``````

This will test if your defined function works as expected. If the function shows an error that indicates that your implementation is wrong. In fact, the code you have pasted doesn’t match with the mathematical formula so it would give an error. In any case, please refrain from pasting your code in the forum.

Thanks for support @albertovilla. I am getting following error when i execute my code. So my question is - in my code block i have written my code for sigmoid and that works fine, do i need to create a sigmiod_test function and code as well?

NameError: name ‘sigmoid_test’ is not defined

Hi @vikas_archana, just to be sure we are talking about the same assignment. You are working on the “Logistic Regression with a Neural Network mindset” notebook (course 1, week 2 assignment), right? In the Exercise 3 you have to define the sigmoid function and right after that there is the code I mentioned in my previous message:

``````print ("sigmoid([0, 2]) = " + str(sigmoid(np.array([0,2]))))

sigmoid_test(sigmoid)
``````

The `sigmoid_test` function is already defined, you don’t need to do anything, it is part of the grader to check that your implementation of the `sigmoid` function works as expected.