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.
Had no idea you could create variable names like this for index's, or even accesing the pair with a ,
Nice!
Superb, clean solution! I didn't think to combine summing the digits into the key function directly.
Very easy to read too!
I like your solution... very clever
lovely :)
This solution might not be the shortest one, but it certainly is the most natural and simple. One can understand it from the first glance.
Quite a nice little solution, I like how it follows the progression of making the sequence of the drinks.
@dmc5809, you could google "python sort key" to get an explanation yourself, you know?
Great solution. I am confused as to how key=weight_key is working. I see you are using the function as a keyword arg, but the function is not being executed (). Can you explain more please?
Thanks
The sorted key parameter receives a tuple from
weight_key
which contains two values: First the weight-value, and second the string value itself.In your example using "11" and "20000" the keys are thus (2, "11"), and (2, "20000"). Hence the weigh-values are equal, but the string values differ and are sorted accordingly.
I hope this clarifies it.
but how to resolve "11" and "20000"?
Tuple sorting seems best here.
@aliasfox
,Thanks for the comment!
I like the variable names, most straight forward I've seen on this challenge. That code needs absolutely no comments. Kudos.
The text representation of the pyramid is not well aligned. In this alignment, you are only allowed to go straight-down or right-down, not left-down.