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.
Could you elaborate on why you consider it not a good solution?
I can agree with that.
Assigning a name to a lambda function.
Which part?
Bad practice
Not a good solution, but a cool one.
Here the goal was to show how you can work with lambda and other python chips, so that newcomers learn something new.
It is bad practice to assign a lambda to a variable. PEP8 states that its an Anti-Pattern.
Just declare a normal function if you want to use it more than once.
See also: https://docs.quantifiedcode.com/python-anti-patterns/correctness/assigning_a_lambda_to_a_variable.html
Why bad practice? If this needs to be done, let's say in the key= or somewhere else like that. Here's an awkward example: arr = [(1,4),(2,3),(1,3)]; sorted(arr, key = lambda e: sum([*range(*e)]))
Bad practice, but clever :)
I know this works fine since Python uses lexicographical ordering but i think
would be "cleaner".
This comment is hidden because it contains spoiler information about the solution