I do not understand what is the problem with the test, I have made the equation outside the cost function and it works well, but when I test it THE NEXT TEST fails.

I did not use any global variables.

Try putting the equation inside the function, it says dont use global variables soâ€¦

I put it inside the function.

But, I check how it works first by printing it outside the function, then comment and keep it inside the function only.

There is an obvious â€śorder of operationsâ€ť landmine in the L2 calculation that Iâ€™m guessing you stepped on. Try the following and watch what happens:

```
m = 5.
x = 1. / 2. * m
y = 1. / (2. * m)
```

If youâ€™re expecting x and y to have the same value, youâ€™re in for an unpleasant surprise.

Thanks a lot, I thought () and * have the same order.

Not sure what you mean by that, but the point is that () over-rides everything, right? Thatâ€™s literally what they are for.

The relevant point is that / and * have the same order, so they get executed from left to right, which is you need the parens as in the y expression I gave above in order to implement the L2 formula correctly.