Ad
  • Custom User Avatar

    ... we will output -1 as a sign of error as concentration will not be negative.

    But there are random tests that expect a negative concentration, e.g.

        [37, 31], [6, 8], 1  =>   -3.4347826086956523
        [61, 1], [5, 4], 74  =>   -1301.6666666666667
        [14, 27], [1, 8], 5  =>   -1.0526315789473684
    
  • Custom User Avatar

    e.g. [2,2], [4,4]. Indicating 2 units concentration of this chemical will absorb 2 units of light and 4 units concentration of this chemical will absorb 4 units of light.

    This example is ambiguous, both absorbance and concentration have the same values. It is not clear if the input format is (absorbance, concentration) or (concentration, absorbance).

  • Custom User Avatar

    In python points shuld be tuples, not lists.

  • Default User Avatar

    Yea, I do not aware that!. Added criteria that answer will not be equal negative and -1 is used for invalid input. Thanks for your idea. Sorry for using 'undefined' which cause confusion.

  • Default User Avatar

    True! In this kata, it is an over-simplified version of the whole process by just simply referring result that cannot conclude the result as undefined. In reality, more standard will be made to deal with that, thank you for your comments. Much appreciated.

  • Custom User Avatar

    Well, the description is surely confusing both of us here.

    Anyways, there is a problem here: the two cases of vertical and horizontal slope are of different natures, and yet they're clumped together, and insufficiently explained.

    There is only one slope in which the concentration is undefined, when the absorbed light is the same regardless to the concentration. In the other situation, where the same concentration gives different absorbed light, technically there is always a solution; it's only from the context of the problem that we say this is a invalid input, as one concentration should give only one absorbed light.

  • Custom User Avatar

    Not yet, because -1 is a valid answer at the moment. Note that you haven't specify that the result should be non-negative (as a valid concentration value should be).

    If you change this to -1 then you first need to specify this in the description, and the add additional tests to enforce this. Currently code that doesn't handle this can pass all the tests.

  • Default User Avatar

    I will change 'undefined' to -1, is that ok?, thanks

  • Default User Avatar

    if they absorbs the same units of light, the concentration can't be determined as no matter what is the concentration, the units of absorbance will be the same. Thanks for the suggestion btw, i will correct it now, I am new in creating kata, hope i will make sth great at last. Thank you.

  • Custom User Avatar

    There will be some cases where the answer cannot be determined, lets say if the 2 points are the same points or the line is a horizontal or vertical line. In this case, having experimental error, we will output 'undefined'

    [[6, 27], [6, 2], 76]
    6.0 should equal 'undefined'
    

    I don't think you really understand the math in this situation. If it is a horizontal line, what is the issue? It just means the compound absorbs the same units of light regardless of its concentration. There are no reasons the result should be undefined.

  • Custom User Avatar

    Outputting 'undefined' as a string while normal output is a number is a bad practice (it makes the kata untranslatable to the majority of the strongly type languages without insane workarounds). Returning None in this case is more appropriate here.

    Also, why is input passed to the function as one heterogeneous array (3 elements of different types) and not one element per argument? Again this does not make sense, and strongly type languages do not like this.

  • Custom User Avatar
  • Custom User Avatar

    You're welcome. Looks like this issue is resolved. You can go ahead and republish this kata when you're ready.

  • Default User Avatar

    Thanks a lot for the suggestion. I am new to creating kata and also coding(lol). I haev made some corrections based on your suggestion. Hopefully, it will solve the aforementioned issue. Do you mind spare some time to check my work again? Thank you.

  • Custom User Avatar

    Fixed and random tests should be separated out into their own describe/it blocks. I'm creating this issue to force this kata back to draft as I believe the floating point comparison issue I raised is going to piss a lot of people off.

  • Loading more items...