You need to sign in or sign up before continuing.×
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.
oh my
Instructions: "You can not use multiplier "*" operator."
I think this kata has been reviewed and its issues with Python addressed, because I found none of the problems that past users encountered. Thanks for the improvements!
Inside the lambda expression, on the right between parentheses (), it defines a tuple containing the original string s in the position 0. In position 1, it removes the last letter form the original string using the index s[]. On the left between brackets [] goes an expression that will act as the index of the tuple. If the original string does not end with an exclamation, the expresion s.endswith('!') will return a 0, selecting the value at position 0 of the tuple, so the lambda returns s. On the other hand, if the original string ends with an exclamation, the expression s.endswith('!') will return a 1, selecting the value at position 1 of the tuple, so the lambda returns s[]. This is basically control flow but using indexes instead of if-else expresions.
O___O
Oh, sorry! I thought these comments were only visible to users that had completed the kata. I'm trying to flag the spoiler but it says I'm not authorized to do so. I can't find a way to delete the comment either now, maybe due to your reply
This comment is hidden because it contains spoiler information about the solution
It's just a bit of harmless flavour...
Didn't know about this, thanks!
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
0___________0
Neat! Never even thought about this
Am I the only one that finds this sort of one-line code unnecessarily messy?
Like, ok cool, it's in one line, but barely readable...
I guess the description has been massively improved after all the complaints. Now it's basically a matter of turning the formula into code while paying attention to the units, which is not a bad 8kyu exercise for beginners. Not the most interesting either, but still...
Loading more items...