Ad
  • Custom User Avatar

    "alr approved some time ago"

  • Custom User Avatar

    Comparison operators such as <= and > coerce their arguments to numbers, if necessary. ( If this is, indeed, JavaScript. )

    Coercion has some subtleties though, that's very probably what's biting you. If you're new to coding, it is probably better not to rely on coercion; there are other ways with fewer subtleties, that will inflict fewer bugs.

  • Custom User Avatar

    The argument s passed in is a string not a number, you need to test whether the string represents a single valid number.

  • Custom User Avatar

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

  • Custom User Avatar

    CW GitHub Wiki - Kata Best Practices - Follow Established Conventions

    [Python] Name of user solution should be is_digit not isDigit (source: PEP8).

    As a side note, I don't get why the function would even be named "is digit" in the first place? We're testing whether the given string represents a valid number (which more often than not contains multiple digits along with an optional decimal point and/or a negative sign), not whether it represents a single digit.

  • Custom User Avatar

    Thank you Johan. I was able to get all the tests to pass after your tip. All the best. Chris

  • Custom User Avatar

    Print not just the input, but also the type of the input. If it's a string, also print the length.

    This does not really have anything to do with this issue - the input is very probably correct in this specific case ( if it is what I think it is, that is. )

  • Custom User Avatar

    I added a translation for C# if anyone is interested in having a look at it.

  • Custom User Avatar

    I want to follow up with a specific example. I was able to get 410 of 411 tests to pass. I have one test that will not show me an outcome via console.log and still fails. No idea where to go from here. On a level 8. I was able to get one other with no console.log output working.

    If anyone wants to point me in the right direction, I would appreciate it.

  • Custom User Avatar

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

  • Custom User Avatar

    https://www.w3schools.com/js/js_type_conversion.asp
    When JavaScript tries to operate on a "wrong" data type, it will try to convert the value to a "right" type.

  • Custom User Avatar

    Below the code editor there's a Sample Tests section. You can see the basic tests there. If you want to find out the inputs of the main tests, you should System.out.println(argumentVariable) inside the function to see it.

    By the way, you solution doesn't work because the input is a string, you can't subtract strings.

  • Custom User Avatar

    Usually you can write to standard output of some kind, the exact way depends on the language. For C# it's Console.WriteLine, for Java - System.out.println, console.log and similar for JavaScript etc. You can see the program output in the test output window.

  • Custom User Avatar

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