Assertion error of

“Error: Wrong output. for variable in position 2.” appeared although my output was as expected and after running the remaining cells no error has appeared, this means that my code is right so why this error appeared,

the error in the below screen shot

Hi,

there should be quite a few tests probably in the File->Utils file or similar naming that you can access from your assignment. You should check those tests in order to identify which one you are failing, and then you can take it from there.

One should always be cautious about assertions like this. Suppose you were asked to implement a function that computed the product of two input parameters. In the first test case, both parameters have a value of 2. The expected output is 2*2 or 4. If you wrote a function that always returned the integer 4, it would pass the first unit test. If you implemented a function that added the two parameters instead of multiplying them, it would also pass when the parameters were 2. Both implementations could pass a unit test; neither would be ‘right.’ Both would likely fail other unit tests, or worse, fail after deployment.

One can only prove code didn’t fail a particular unit test. This doesn’t prove that the code is ‘right.’ This holds beyond software testing as well. One can disprove a theory through a single counter example, but no amount of data can prove it true. Only more or less likely.

As @gent.spah suggested you can read the code for the unit tests. Look at the test case parameters. Run them through your function yourself. Make sure you understand why they produce the output they do. Think about how your implementation might have passed one unit test in the notebook, but failed this one. Let us know what you discover?

I searched if there are possible errors in the previous functions and found that there was a simple mathematical error in computing the standardization equation in the previous functions

thanks too much @gent.spah @ai_curious