Ad
  • Custom User Avatar

    That's the problem I have now, haha. I only consider real life years...
    I have to modify my function...

  • Default User Avatar

    Wait I think I figured it out...

  • Default User Avatar

    Another example of why I'm confused:

    test case where input = 451054599
    correct result is 21
    my result 112

    451054599 % 13 = 8
    21 % 13 = 8
    112 % 13 = 8

  • Default User Avatar

    I just meant it's funny that if I input my incorrect result as input, the new result is the correct answer.

    My code is working on everything besides 33 of the random tests. I logged n to see what the input is and it doesn't seem any different than the other test inputs other than it being a different number. Can't figure out what is causing the majority of inputs to work, but not for a few.

  • Custom User Avatar

    113 is what your function returned instead of 22, to see what the input is, print it, it'll appear above the test result, read this: https://docs.codewars.com/training/troubleshooting/

  • Default User Avatar

    Anyone know the difference here between the random tests and basic tests?

    I'm passing all basic tests and 168 / 201 random tests.

    failed random test example: expected 113 to equal 22.

    Locally if I input 113 as n the result is 22.

    What am I doing wrong?

  • Custom User Avatar

    Very bad description for this Kata!

  • Custom User Avatar

    Sorry, I already delete or edit the comment, I'm new to this

  • Default User Avatar

    Going by the instructions given, the result is incorrect.

    I'm sure that is part of the reason this is only rated at 85%.

  • Custom User Avatar

    I've changed difference for distance to make it crystal clear.

  • Custom User Avatar

    Difference means: the result of subtracting one number from another. How much one number differs from another. From the title "Compare with Margin", the difference is going to be a positive number since you are comparing the the difference between the 2 numbers given and the margin. Say on the number line you have a point at -5 and another point at 6 and you are trying to see if the margin between the 2 numbers is less than 12. You would not say because -5 -6 = -11 and -11 is less than 12, you would get the absolute value of -5 - 6 and compare the two. It doesn't need to be explicitly written in the directions.

  • Default User Avatar

    The instructions don't say either a-b or b-a, they say very clearly a-b. They don't mention the difference having to be a positive number.

    in my example:

    a-b = (-1272 - 7169) = -8441. Does it not?
    -8441 is less than the given margin (1339). Is it not?

    According to the instructions given, these params would return 0.

  • Custom User Avatar

    Do you know what margin means? When you measure something, and it's not an exact measure, the number is noted as X ± Y where Y is the margin or tolerance. With a difference of 8411 (or -8411) and a margin of 1339, does that sound "close" to you? Close -> distance.

  • Default User Avatar
  • Default User Avatar
  • Loading more items...