Ad
  • Default User Avatar

    Ah, we may have a killer objection here :-) ...in that's how most people speak:

    "the house costs two hundred thirty thousand, four hundred and ninety-nine dollars."

    "the house costs two hundred and thirty thousand four hundred and ninety nine pounds."

    I think you're right, and that this alone could make the problem too clunky for codewars in that it's not a neat, unambiguous problem with with a clear solution.

    I'll make such improvements as I can following your helpful criticism.

  • Default User Avatar

    First, I am surprised that you want the way to write a number to be defined, if it's not obvious then to explain it would take, IMO, far too long to do unambiguously. Further, I'm not sure what you mean by allowed/not allowed. I've said the range of possible numbers; what might not be allowed, as an example for me?

    Second, yes the choice of how to represent 'point zero' is quite arbitrary, it's just (slightly) more difficult that way.

    Clearly you don't like this problem. Fair enough; and if the community doesn't like it, I can delete it.

  • Default User Avatar

    The exact case you mention is included in the test cases.

    I have updated the description to make the point explicitly

  • Default User Avatar

    Use of include? I don't think will do what you want here, although I have to say I'm not quite sure what your intention is, sorry.

  • Default User Avatar

    Your description does not reflect what's required; I have reworded the description again, please see if that's better.

    Your example is incorrect; change('aB#h **& Z') => '11000001000000000000000001'" is correct, setting the chars to '1' that correspond to 'a', 'b', 'h' and 'z'.

  • Default User Avatar

    missmaggiemo, thank you for pointing out some flaws in my test cases, now corrected.

  • Default User Avatar

    Hmm, I clearly haven't made it clear :-) that the objective is to validate the string.

    New wording "This method accepts a single argument, a string to be validated.

    The string can be of any length and have any contents. But to be considered valid, it must have zero or more blanks followed by zero to eight numeric digits followed by, again, zero or more blanks.

    If it is valid, the number within the string + 1 is returned. Otherwise, the string 'invalid' is returned. A completely blank string is considered valid, equal to zero.

    '   7   '     returns 8

    '     a  8 '     returns 'invalid'

    '    ' returnss 1
    'abc1' returns 'invalid'

    An easy problem.

    The only slight challenge is to produce a simple method that has no regular expressions and no nesting; no explict nesting with 'for' or 'while' or whatever, no block nesting with things like 'map' or 'each'; obviously I have no way of enforcing this!"

  • Default User Avatar

    Done as suggested, thank you -- sorry about the delay.

  • Default User Avatar

    Ah, I see, forgive me for being obtuse, you are correct and with any luck I've fixed it now.

    Thank you.

  • Default User Avatar

    I checked both the assertion and the description and they look correct to me. Now I'm confused too... :-)

  • Default User Avatar

    I am shame.

    I substituted a broken version for the original correct one because I hadn't double-checked the tests.

    My apologies. I hope it's better now... :-(

    Thank you for your feedback.