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.
I knew there was going to be something much more simple than what I wrote (facepalm)
Wow, such a creative but simple solution. This Kata has a lot of great solutions, too bad the ones that are already upvoted are the first ones you see. This is probably the best.
They should allow best practice and clever to go to the same solution. This is both, by far.
Question. I came up with a very similar solution. Only difference was I used name.lower()[0] instead of name[0].lower(). I'm not super familar with best practices in terms of performance. But did you choose your solution name[0].lower() because it technically performs quicker than name.lower()[0]?
Thanks for any insight you can provide!
This was the solution I came up with as well. One question I have for myself and everyone else. Would this perform better if we replaced name.lower()[0] with name[0].lower()? This way it wouldn't lowercaase the entire string, only the first letter. Obviously in this example the diffference in performance is negligible, but just looking to develop best practices in terms of performance as larger applications may see a more substantial impact with the slight coding difference.
Thanks for any feedback
This is great! Thanks for using these operators that I've never seen in use before and for explaining. It prompted me to watch some YouTube vids on them and learned some new stuff which is why I'm here.
Why isn't this grouped with the first solution?
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
I think I see what I was misunderstanding about how the first solution is working. I was misunderstanding exactly what line 8 was doing. But I've got it now.
Maybe I'm missing something about how the top soultion is working. I wouldn't think it would work in the case of '(){}' or '({(){}})' but I may be mistaken.
I think this is actually the better answer of the top two because it should work in all circumstances. Surprised that the other one has so many upvotes because it seems that it shouldn't pass all cases.
Would this work for a string '(){}[]'?