Hacker News new | past | comments | ask | show | jobs | submit login

That's close, but basically you need to take the square of each element first, e.g. `m * * 2` [0]. This keeps the shape of the matrix while `m.prod()` returns a single number (multiplying each element together).

So it should look something like this: `np.sqrt((m * * 2).sum())`

Re: The error message, it looks like it's occurring because `sum` doesn't normally take any parameters and interprets the argument as an "axis" parameter — https://numpy.org/doc/1.18/reference/generated/numpy.sum.htm...

Order of operations is tricky and I could do a better job breaking it down. Still plan to add the Show Solution button but need to get some sleep :-).

In the meantime you can see all the possible solutions in the repo! https://github.com/vthommeret/mathtocode/tree/master/questio...

[0] Remove the space between the asterisks / I had to add it since HN interprets them as italics.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact