Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Added.
This comment is hidden because it contains spoiler information about the solution
(Assuming Haskell version)
I'm also new to functional programming, so maybe someone can comment on this. I found this challenging, it took me a while to work out what I was being asked to do, and then a while to work out how to do it.
I think the exact problem is quite contrived, but there are cases where you get passed a function or need to pass a function into something. Or you want to iterate over some functions that on the surface seem very different. A number seems very different from a math operator, but this shows that you can consider both to be functions.
I'll put a 2nd comment with a spoiler warning.
This comment is hidden because it contains spoiler information about the solution
Numpy arrays apply '==' elementwise, so you get an array of truth values. This cannot be converted to a bool so cannot be directly used in an 'if' statement, which at some level the test will be doing.
Python lists compare equal if they have the same values for every element.
I think it also makes a difference if you calculate as w/(h*h) or w/h/h
The test cases should not sit on floating point boundary.
A tolerance is needed on the comparison. The out can depend on things like if you sum in an int or double, if you round the mean, and probably many other subtle things.