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

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

  • Default User Avatar

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

  • 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/

  • 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.

  • 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.

  • Custom User Avatar

    When a is lower than b, return -1.

    -1272 < 7169, right? The difference between a and b is always positive (think about it like a distance, there is no negative distance). So if b > a you should compute b - a instead of a - b or always take the absolute value of a - b, your choice.

  • Custom User Avatar

    hey, I'm a litle bit stupid, but even I did it. In first view it seems harder than 8kyu, but its not true.