Ad
  • Custom User Avatar

    python new test framework is required. updated in this fork

  • Custom User Avatar

    Duplicate issue. This kata has rounding issues, it has already pointed out in the next message, no use to raise more issues about that.

  • Custom User Avatar

    What rounding are you using? I got an error for 18 people where the reference solution expect 0.35 but I return 0.34

    The calculation comes out at 0.34279 when rounded to 5 places, which is 0.34 rounded to 2 places.

    You need to allow for differences in round and an error of +/- 0.01 or specify round UP or DOWN to 2 places...

  • Custom User Avatar

    The author is long gone, so someone else will have to fix it.

  • Custom User Avatar

    The values have to be compared for approximate equality, especially when the difference between the result of an O(1) formula and the value returned by the reference solution (without rounding) can be as high as 0.01 - have fun dealing with numerous off by one errors.

  • Custom User Avatar

    When the kata is not about programming but a mere math formula coding it is better to give the formula. It took me 25 minutes to find the formula and 1 to code it.

  • Custom User Avatar

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

  • Custom User Avatar

    Can someone please tell me how to round this because I am only out about by 0.01 on an average of 4 out of 23 test cases:

    ✔ Test Passed: Value == 1
    ✔ Test Passed: Value == 0.97
    ✔ Test Passed: Value == 1
    ✘ calculateProbability(15) - Expected: 0.25, instead got: 0.26
    ✔ Test Passed: Value == 1
    ✔ Test Passed: Value == 1
    ✔ Test Passed: Value == 0.92
    ✘ calculateProbability(15) - Expected: 0.25, instead got: 0.26
    ✔ Test Passed: Value == 0.81
    ✔ Test Passed: Value == 0.75
    ✔ Test Passed: Value == 0.73

    etc.

  • Custom User Avatar

    Can someone explain please?

  • Custom User Avatar

    Thanks for this kata @Et2rn1ty! I would suggest to rephrase your description to clarify that you are asking for the probability of at least (and not any) two people having their birthday on the same day. This is actually the probability we are calculating in this kata. Other than that, very good idea.

  • Default User Avatar

    Solved the 'rounding to 2' problems by turning my 2-d.p. answer into an int and back again - ie 0.01 * integerOf( 100 * answer). This cut the errors down to 1 or 2 and I eventually lucked out with a set of random tests that didn't trigger an error.

    Bit of a pain though ...

  • Default User Avatar

    Also getting these errors (although also an occassional "expected 0.17, instead get 0.19" - which surprised me because I can remember this from a stats lecture, but anyway)

  • Default User Avatar

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

  • Custom User Avatar

    are you returning a string?

  • Default User Avatar

    I am getting the right answers but still the test is being failed, any idea what could be wrong? Thanks in advance!
    calculateProbability(81) - Expected: 1, instead got: 1.00
    calculateProbability(78) - Expected: 1, instead got: 1.00
    calculateProbability(40) - Expected: 0.89, instead got: 0.89
    calculateProbability(42) - Expected: 0.91, instead got: 0.91
    calculateProbability(12) - Expected: 0.17, instead got: 0.17
    calculateProbability(100) - Expected: 1, instead got: 1.00

  • Loading more items...