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.
Ah you are absolutely right. Didn't think of the visibility of the solution.
next time, don't post the solution of the hard version in the easy one, thx.
(look at the top of this solution, if you don't understand why...)
You used my previous solution ;)
0 is False and 1 is True
do you want it to return 0 when not even, and 1 when even?
def dude():
return "Where is your PEP?"
print(dude())
Whew.. passed all tests except one for a long time. Found out that I altered the change for this test in another place than where I altered the changes for the rest. Shoot me. This was a really interersting kata though, thanks!
Hello,
I don't know if it´s intended, but a function wrote in one single line is extremely difficult to read and understand what it is doing, mainly because of all the if-elses.
Damn i always forget to use the return of the sorted method, thanks for the tip :)
A tip: you could just replace
list
withsorted
to make it shortersort = lambda x: ''.join(sorted(filter(str.isalpha, x)) + sorted(filter(str.isdigit, x)))
And it's also sorting less element
If performance is a concern, it's still better to write the 'yield' expression. These are lazy gens and they're sometimes half as slow, but it's likely just splitting hairs unless you're working on exceptionally large sets of data.
Actually, generally accepted best practice is to not use named lambdas. Lambdas should be 'throw away' expressions, not statements and
def
fn's will usually eek out performance over λ expressions but not by anything really noticeable unless you have some order of op stuff going on. If you really want to make this fn sing, use a generator, ala my fork.using a lambda, an "anonymous function" to make a named function is sooOoOOoOOooOooOooOo smart and definitely not bad practices. Most linters will yell at you for this.
Partial goal of the solution is to use no modules
According to PEP 8, Programming Recommendations:
Loading more items...