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.
Needs random tests.
i like this solution a lot. i can clearly visualize each line and what it represents. some other solutions posted may seem elegant but they really are just concise to the point of incomprehensibility. thank you for this
I had to test, did not think this would work for the value 0 - it does
This comment is hidden because it contains spoiler information about the solution
As Jim Hartnett wrote one month ago in general discussion section:
The sample test for python is broken. expect_equals needs to be assert_equals instead, and the answer should contain one more space.
The task was great, the exercise not that great. The format for the results should IMO be a list rather than a string. Consider terms "55-5" => "555-" and "5-55" ==> "555-"...
Expecting a list for the result would enable one to re-use the same code for the calculator-kata, and later for the interpreter.
Also it would be nice to test some error handling, e.g. define error strings for missing paranthesis or some other malformed terms.
Anyway, I worked around it by converting the list into a string at the end of the function in order to accommodate the exercise when a certain flag is set, otherwise it returns the list.
Again, thanks for the task :-)