Ad
  • Custom User Avatar

    Hey I learned this today too! 3 years later though...

  • Custom User Avatar

    Thanks (◕﹏◕✿)

  • Custom User Avatar

    Great Kata! Hope to see it in approved

  • Default User Avatar

    looks good to me

  • Custom User Avatar

    got it

  • Default User Avatar

    I would still consider changing this:

    Random Test Case
    
    Log
    ['59306 - NlfzEhom - 68.9 92.8 22.8 97.0', '01815 - hJTbdHZK - 00.7 14.3 32.1 98.0 48.3', '61722 - VhFNAGqW - 64.5 24.6 49.5 89.9 93.4', '83273 - fNGmMGKm - 98.9 00.1 96.9 23.3 44.6', '27520 - MUgMUYio - 43.0 15.0 05.1']
    

    Remove the log, and add the message you are logging in the "it", so it's part of the test case.

  • Custom User Avatar

    Okay I believe I followed the proposed solution of "unique" scores by comparing the values formatted to one decimal points, if there are same values I create a new list for testing, else I continue.
    As for the i, I had it just for my logging purposes, so I removed it.
    Let me know if this satisfies the criteria that was originally posted.

  • Default User Avatar

    Also about the ordering, the problem is you get 58.21999999999999 while we get 58.22. If 2 students have silimar scores like this, your order might be student 1 -> student 2, while ours is student 2 -> student 1. A secondary key won't change this. The problem is how the mean gets calculated differs between your solution and ours, it's not clearly specififed how to get the mean, and the chosen implementation changes the outcome.

  • Default User Avatar
    @test.it('Random Test Case '+str(i))

    Not sure how relevant "i" is. Perhaps you can display "students" in the "it".

  • Custom User Avatar

    So I ran some tests, and it seems that there isn't secondary sorting based on id:

    Test Case: ['B000 - Bruce Wayne - 100', 'A000 - Alfred Pennyworth - 100', 'K000 - Kate Kane - 100']
    Attempt: [('B000', 100.0), ('A000', 100.0), ('K000', 100.0)]  | Desired Answer: [('A000', 100), ('B000', 100), ('K000', 100)]
    
    Test Case: ['100 - AaBb - 100', '990 - CcDd - 100', '555 - EeFf - 100', '90 - GgHh - 100', '9354 - IiJj - 100']
    Attempt: [('100', 100.0), ('990', 100.0), ('555', 100.0), ('90', 100.0), ('9354', 100.0)]  | Desired Answer: [('100', 100), ('555', 100), ('90', 100), ('9345', 100), ('990', 100)]
    

    If you want, I can add secondary sorting. As it is now, my solution (the attempt above) only sorts based on grade and keeps it in the same order rather than sorting based on alphanumerical characters in the id.

    As for the other notes you left, I believe I implemented them (I learned more stuff on test cases!).

    EDIT: I should have refreshed before submitting... whoops >u<

  • Default User Avatar

    Your proposed solution of "unique" scores seems the easier way out of this, without changing the spirit of the kata :)

  • Custom User Avatar

    yeah, that's another way. But there you find the need for the secondary key again, I believe.

  • Default User Avatar

    If ordering depends on floating point numbers, perhaps this kata requires exact floating point numbers (Fraction) instead?
    For the moment, this kata remains ill-defined because of the disprepancy we just found.

  • Custom User Avatar

    @jf952: ok, it seems it's because I use the module while you use... "bare computation", let's say. That's pretty weird, but... nothing related to sorting (I was actually wrong about that, apprently... I'd need a refresh about this detail, maybe).

    I see only one way out of this: you try your random inputs and check there are no two students that can be considered "equal". If that's the case you generate another array instead of doing the test

  • Custom User Avatar

    holy fuck... x(

    mine: [('74957', 58.22), ('52356', 51.56), ('99165', 51.56), ('97826', 49.36), ('06161', 42.82), ('81397', 31.033333333333335), ('70243', 25.166666666666668)]
    his:  [('74957', 58.21999999999999), ('99165', 51.56), ('52356', 51.55999999999999), ('97826', 49.36), ('06161', 42.82), ('81397', 31.03333333333333), ('70243', 25.166666666666668)]
    

    the problem doesn't come from the sorting but from the float computation......... Pretty weird considering what we use.... :/

  • Loading more items...