I need more help in Exercise_2 of First Programming Assignment

I am getting a wrong output, as follows

import math
from public_tests import *

GRADED FUNCTION: basic_sigmoid

Removed as it violates our code of conduct

print("basic_sigmoid(1) = " + str(basic_sigmoid(1)))


after I ran the cell, I got the following;

basic_sigmoid(1) = 3.718281828459045
Error: Wrong output.
1 Tests passed
1 Tests failed

AssertionError Traceback (most recent call last)
1 print("basic_sigmoid(1) = " + str(basic_sigmoid(1)))
----> 3 basic_sigmoid_test(basic_sigmoid)

~/work/release/W2A1/public_tests.py in basic_sigmoid_test(target)
21 ]
—> 23 test(test_cases, target)
25 def sigmoid_test(target):

~/work/release/W2A1/test_utils.py in test(test_cases, target)
24 print(‘\033[92m’, success," Tests passed")
25 print(‘\033[91m’, len(test_cases) - success, " Tests failed")
—> 26 raise AssertionError(“Not all tests were passed for {}. Check your equations and avoid using global variables inside the function.”.format(target.name))

AssertionError: Not all tests were passed for basic_sigmoid. Check your equations and avoid using global variables inside the function.

Please I need more explanations

Hi @Chukwu_Nnaemeka_Paul,

I have edited your post because it is against our rules to share solutions to code.

As far as I could read from your code, you are not using the value “x” that the function takes as argument.

This is why the tests are failing. The function you made returns the same value for every x.

I hope that helps.


This is a duplicate thread. I already answered on your other thread about this. In addition to the hard-coding of the parameter value that Lucas pointed out, your implementation does not match the math formula given in the instructions.

So sorry for the duplicate thread, I’m still trying to understand what I’m expected to do

Thanks for your response, but please I need more clarification. I’m getting more confused.

I gave you some fairly specific suggestions on that other thread. Why don’t we use that one?