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 don't think it's bugged so much as underspecified. I was getting this error until I started rounding down every iteration on my solution.
Just figured it out; your tests are backwards. They list the actual answer as expected and vice versa.
This comment is hidden because it contains spoiler information about the solution
Just tried
StandardError
, still halts.EDIT: Nevermind! I had the conditional wrong.
StandardError
works fine. Thanks!I do think this may be worth mentioning in the instructions, though.
For bad input: If I don't raise an exception, the tests tell me I'm supposed to raise an Error if the parameter to
inc_progress
is out of range. If I raise an exception, the tests halt when the exception is reached. What kind of error am I supposed to throw that will allow the tests to actually finish?EDIT: This is the ruby version fwiw
No, recursion will just get you a stack overflow on the same problem. I actually had to rewrite mine from recursion to a while loop to pass it.
The current #1 solution is arguably incorrect. It's busted by this test case:
"123# comment!"
(fwiw Ruby actually does recognize that as a comment, too)
It should say "all text on the same line after a comment marker". That's why the stuff after newlines should be preserved.
I finally figured it out. Ambiguities that I can see:
I just wanted to mention that I legitimately can't figure out what is expected here. There is no way for the caller to submit a symbol vs. a string so why are we treating them differently? Under what circumstances are we to modify the string key? I'm failing the second test but the error message is no help either.
Does the third bullet point mean that if they try to assign to a nonexistent key, we should return nil and not assign anything? Or do we assign something and return nil?
Also, if this test case is correct, when would you ever update the string key?
Should the parameter in the final method be called
item
rather thanitem_index
? Or am I misunderstanding the question?The parameter should be called "number" rather than "numbers". It's a single value.