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.
i knew how to do this but i forgot lol mine is first solution
wow
this blow my mind, need to go read documentation.
red pill or blue pill?
This comment is hidden because it contains spoiler information about the solution
@hfaran: I have no idea why they should be. If eta-reduction works in Python the same way it works in other languages, both variants should be the same.
I'll bite. Why, indeed, is wrapping it in a lambda any better or more valid?
How does this solution work?
reduce
will throw an error, I suppose. A more correct answer would change the end to:What happens if "number" is 0, 1, or 2?
To be fair, most real world, practical problems have more complex and less elegant solution requirements. This is a simple, elegant problem, and I figured it called for a simple, elegant solution. Plus, I disagree that this is less readable than the 4-5 line for loop/if block solutions- There's hardly any control flow to speak of, so it requires less effort to track how the algorithm works. It's just two simple data manipulation operations.
Also, your brain may like inclusive, but you'll be chasing fencepost errors for the rest of your life.
"Finish the solution so that it returns the sum of all the multiples of 3 or 5 below the number passed in."