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.
Like @crunker99 said above, it's worth noting that this evaluates the expression for every single day. Fine in this case because they're all very cheap, but something to keep in mind.
This comment is hidden because it contains spoiler information about the solution
Only thing to note about this pattern is that every boolean statement is evaluated. It's fine here, but if the conditionals were more complex/long-running functions, every single one of them would be called. You could instead return a function from the dictionary, and call that function with the
num
argument, to evaluate it.oh wait, this is not a lambda, just normal arithmetic/logicla expressions...clever
I love lambdas
Very nice. I was thinking on how to shorten lambda functions for each case but could not think of how to access the conditions only from the dict.
I wanted to do something like that but I couldn't think of how to do it. Great way to do it!!
Wow!!! learn somethin new every day, no idea you could do that. Pretty neat , gonna save this
This comment is hidden because it contains spoiler information about the solution
Agreed.
This comment is hidden because it contains spoiler information about the solution
If you'd check if num is even than you could iterate with i+=2 instead of i++ and get x2 times faster solution
They are less than 2 (and not prime). A prime is a natural number greater than 1 that has no positive divisors other than 1 and itself.
What about all negative numbers?
This comment is hidden because it contains spoiler information about the solution
Loading more items...