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.
damn, did the same thing but replaced -1 with len(arr) -1, yours is much simpler lol
Wow.. I made mine way more complicated
This is an excelent use of String Slicing in Python
@fran496: no, but they're iterable objects that support indices, just like lists - except every element in a string is a single character. This means most of the syntax elements that can be used on lists can be used on strings as well.
except for mutating elements, you can do that with lists but not with strings
the kata specifies you don't have to deal with those
Efficiently done!
thanks, elegant !
Best Practice Indeed!
there are none less than 2 char
Simple as it is
thank you so much for explaining it !
damn...
ok but...what about the ones with less then 2 char? iam confused
There's a difference between the normal
if: else:
statement in Python and this. This is specifically what is called a "ternary operator", and it's a different syntax for a different operation (although it does similar things.https://www.geeksforgeeks.org/ternary-operator-in-python/
It's a bit of a shame that Python uses the same tokens
if
andelse
for both the conditional statement and the ternary operator - most languages don't, and it does make it confusing.i dont understand how you can write a whole line with if AND else without any ':' and it works. everytime i try to do something like that i get an error. does someone has an idea of why that is please ?
Loading more items...