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.
Nice solution and the single line ifs make it fairly neat/concise. Maybe not best practice though. In if, elif statements - only one is ever called based on the conditions. In yours it looks at both ifs each time. Also, 'open_counter = open_counter + 1' can be reduced to 'open_counter += 1' and likewise, -= 1.
Nice, clean solution but what happens if there are 3 or more spaces?
imported re for a different method, changed it and different remove import. D'oh
Clever, for sure. Not overly readable for beginners and it doesn't gain any efficiency for being a one-liner.
Two joins, two for-loops. Using timeit.timeit over 1,000,000 executions, this solution took 13 seconds. Others with one loop took 9 seconds.
Best to unpack it sometimes.