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.
'All triangles will be right isoceles.' from the Kata description.
Nice extension to a general scenario though.
I wanted to demonstrate how many different ways this particular task could be solved, I suppose there are still more than what I found...
Also, I learn from playing with code and experimenting in this way. For example, in this case I learned about
ast
andliteral_eval
.Note: encoding can be done with
Why the random choice of 3 methods performing globally the same task (although
eval
is not recommended as usual)?Hard-coded lambda expression with succession of conditional expressions? Not exactly easy to read
Hi, not that
dir
is actually a Python keyword :)Note that this code would run infinitely for negative numbers ;)
But I guess this was on purpose ^_^
done
Not sure it's worth importing for that single use.
My gut feel is that it'd make no measureable difference. That said you can never be sure, so you could benchmark it yourself if you like.
Would import string module make the function run slower?
F# translation for approval
In C#, the name of argument is
n
for an array of integers: is misleading. Consider usingnumbers
or similar name instead.This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Loading more items...