Ad
  • Custom User Avatar

    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.

  • Custom User Avatar

    Just figured it out; your tests are backwards. They list the actual answer as expected and vice versa.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    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.

  • Custom User Avatar

    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

  • Custom User Avatar

    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.

  • Custom User Avatar

    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)

  • Custom User Avatar

    It should say "all text on the same line after a comment marker". That's why the stuff after newlines should be preserved.

  • Custom User Avatar

    I finally figured it out. Ambiguities that I can see:

    • it is not clear what to do in the case where neither key exists but the user is trying to make an assignment
    • the test case for whether to add a symbol key when the user is assigning to a value that has a string key (but not a symbol key) contradicts the instructions
    • it is not clear what to do when symbol and string keys both exist
  • Custom User Avatar

    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?

  • Custom User Avatar

    Also, if this test case is correct, when would you ever update the string key?

  • Custom User Avatar

    Should the parameter in the final method be called item rather than item_index? Or am I misunderstanding the question?

  • Custom User Avatar

    The parameter should be called "number" rather than "numbers". It's a single value.