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.
This comment is hidden because it contains spoiler information about the solution
checking for empty string.
empty string is boolean False so when s exists (== True) Python returns this expression:
otherwise it returns s which is ""
why if s else s?
That's a little bit of a cheeky answer. But thanks! I'm sure it will be a fun journey.
Right here on CW. Complete a few hundred more katas and keep you curiosity!
Wow this was very cool. I would like to know where I can learn to write code like this. (it bamboozles me at the moment.)
Yeah, I gotta admit I could barely understand this code (still puzzles me to this day). At first I thought it was because of my inexperience, but it's relieving to know that this is in fact hard to read and that I don't necessarily need one-liners to write good code. Thanks, man!
Don't be discouraged! These one-liner solutions get upvoted because they show off a lot of cool stuff Python can do, but it's a terrible way to code (unless you're practicing and want to get intimately familiar with every neat trick).
Coding is about documenting logical steps that are human-readable, hopefully with comments that provide more context for the programmers maintaining it. If these were instructions for a Lego set, this would be the equivalent of "Step 1: put all the Legos together."
Doesen't title capitalize the first word regardless wheater or not it was captialized in the original input? My testing suggest yes, so shouldn't it have failed at least one check?
This comment is hidden because it contains spoiler information about the solution
That's pretty cool and concise but it doesn't cover my tests e.g. if u try smth with opostrafs or other symbols.
Edit (I'll concretize):
I don't consider "the!greatest/warrior-of_all-tim'es" -> "the!Greatest/WarriorOfAllTim'Es" as needed behavior, should be "the!greatest/warriorOfAllTim'es", I think, as the subj asks
Does this break in the case of a one-letter word (e.g., 'a')?
see comments below, ~5 years ago
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Loading more items...