6 kyu

Ranking System

584 of 1,107tostaylo
Description
Loading description...
Fundamentals
  • Please sign in or sign up to leave a comment.
  • saudiGuy Avatar

    python new test framework is required. updated in this fork

  • George25 Avatar

    SORRY!! I have accidentally mangled the sample tests. Can you reset them please. I have a one-line solution that works with PyCharm, and I wanto to test it on your data. Thank you!

    • hobovsky Avatar

      You an click the RESET button at the bottom to reset sample tests and solution to their initial form. Back up your solution, click RESET to restore tests, and paste your solution back.

  • JeremyDev Avatar

    input // [1,3,2] output // [3,1,2]

    Man... Why ? You said in the statement that the highest number get the first place, and the lowest the last. Why is the lowest value at index 1 instead of 2 ? I really don't understand.

  • ZawHtetAung-Zhared Avatar

    I took a good ten minutes figuring out why [1,3,2] became [3,1,2]. Sighed.

  • laurelis24 Avatar

    This is almost a clone to this one https://www.codewars.com/kata/545f05676b42a0a195000d95 Nice kyu.

  • bdy916 Avatar

    Hello. After I click 'Attempt' it is expecting a sorted array no matter what. For example Expected: '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]', instead got: '[9, 17, 3, 16, 10, 1, 15, 7, 8, 12, 13, 2, 4, 11, 5, 14, 6]', although the expected array is not the correct one. Can you check please?

    • Chrono79 Avatar

      You're mutating the input array, affecting the expected values.

    • bdy916 Avatar

      Thank you. It worked now!

    • JohanWiltink Avatar

      Not a kata issue then. Closing.

      Issue marked resolved by JohanWiltink 7 years ago
    • Chrono79 Avatar

      I'm not sure if there should be a warning about not mutating the input, getting the expected value first/passing a copy to the user or doing nothing and leaving it as it is. Wondering about the downvote on my previous post, I see no reason for it, but, there's nothing I can do about it.

    • JohanWiltink Avatar

      Doing testing invulnerable to input modification is definitely better kata design ( and explicitly failing solutions that modify inputs is better still ). But ultimately solvers are responsible for not mutating their inputs themselves ( or - yes I sound like a broken record; it's as tiresome to me as it probably is to you - you deserve whatever you get ). A warning should not be necessary, but it might prevent most of the endless f*cking issues by solvers who are still learning this ( generously deleted "clueless" here ).

      I'm not seeing that downvote BTW. I ( though I ) had one earlier on my post below, but I'm not seeing it now either.

    • jamad Avatar

      Updated the test cases for javascript so that mutation of input data is allowed.

    • Chrono79 Avatar

      Thanks jamad.

  • JohanWiltink Avatar

    Speeling error:

    it's

  • jamad Avatar

    Translated it into Python.

  • omearican Avatar

    I think the tests may be wrong. When the test is the following: [ 16, 83, 3, 69, 31, 27, 73, 49, 9, 99, 93, 22, 70, 32, 98, 29, 36, 6, 38 ]

    I get the following result: Expected: '[19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]', instead got: '[16, 4, 19, 7, 12, 14, 5, 8, 17, 1, 3, 15, 6, 11, 2, 13, 10, 18, 9]'

    • Blind4Basics Avatar

      do you mutate the input?

    • Faxxiz Avatar

      Same error without modifying the input in JS :

      [ 19, 72, 16, 50, 25, 92, 80, 23, 40, 63, 26, 99, 42, 18, 68, 3, 75, 96 ]

      Expected: '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18]', instead got: '[15, 6, 17, 9, 13, 3, 4, 14, 11, 8, 12, 1, 10, 16, 7, 18, 5, 2]'

    • JohanWiltink Avatar

      Yes, the random tests are vulnerable to input modification. No, if you do not modify the input the tests are not wrong. Yes, if you modify the input you deserve whatever you get.

      Note that [].sort modifies its input.

      Not a kata issue. Closing.

      Issue marked resolved by JohanWiltink 7 years ago