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.
Underscore is just a convention, "k for k,g in groupby(iterable)" also works perfectly.
It's a method to ignore specific values.
For instance:
a,_,b = (1,2,3)
Then: a=1 and b=3
Another example:
a,*_, b = (1,2,3,4,5,6,7,8)
a = 1 and b = 8
Other function to this is save the last result in "_" variable.
So if you do this:
2+4 -> result= 6
_ -> result= 6 #save the last result in your program.
For separate numbers:
But you can do:
This link helps so much: https://www.datacamp.com/tutorial/role-underscore-python
This is very clever i solved in two lines of code but this is one line this is better and i appreciate it
the %s are placeholders
the string is formatted by replacing the placeholders with the corresponding values from the tupel.
Backslash "escapes" the following character.
I.e. the "[" looses it's special meaning
Could someone explain why there is the use of \ at the start and end of the regex? Thanks
Could someone explain how the last line works? Thanks!
thats wicked!
You can circumvent having to slice [::-1] twice by adjoining the names with an ampersand, and using the replace function to substitute all but the last ampersand. See my solution for details.
I always think guys who make those codes are robots... (and i always take 3 minute per lines for understanding...)
I am curious that if such short coding has benefits to future works? even reading is complicated!
insanely clever
That's a very nice and clear solution, i like it!
Wow. Amazing!
Great idea reversing the string! I learnt something new today.
And I faced the same problem several times before.
Loading more items...