Ad
  • Custom User Avatar

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

  • Custom User Avatar

    Initial sequence:
    1,2,3,4,5,6,7,8,9,10,11...infinity
    Delete every second number:
    1,3,5,7,9,11...infinity.

    From this new sequence, where 3 is no longer the third number, then delete each 3erd number (5, 11, etc.)

  • Custom User Avatar

    I am not shure ho pythonic the solution is.
    It is readable and performant.
    Your solution includes an additional variable. That can make it more readable, but since the function does exactly one thing (calculating a grade), I dont think this adds to the readability.

    The multiple return statements...hmm yes I dont like them that much but since python does not offer a clean switch case out of the box...well.

    Multiple return statements are not forbidden, but I guess PEP8 somewhat discourages you to use them.
    But at the same time, some examples in the style guide also contain multiple return statements.
    So maybe (and I mean maybe) it is fine in this case...

  • Custom User Avatar

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

  • Custom User Avatar

    This solution is wrong, it does not cover all edge cases.
    it just got lucky with the random test cases.

  • Custom User Avatar

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

  • Custom User Avatar

    I wonder why this is not the best practice solution.
    Its much more readable than all the others and works without any imports.
    However I would assume it only works with python 3.6+ since dictionaries only started keeping insertion order since around 3.6 =

  • Custom User Avatar

    I gave this kata a thumbs down..
    According to Dave Thomas, "inventor" of code katas, rule one for a good kata is that the content should never get in the way of the exercise.
    I dont mind the in built in joke. However I think it got in the way of the exercise.

  • Custom User Avatar

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

  • Custom User Avatar

    I ran the authors code on my old Thinkpad T450 and it finished the 50,000,000 in 2,64444 seconds. Not the most efficient, but several orders of magnitude better than 10 minutes.
    Maybe one of the commom mac issues? Thermal throtteling etc?

  • Custom User Avatar

    I am sorry, this was meant for a different solution.

  • Custom User Avatar

    I have a similar solution, however since isupper() has some issues with uncased characters from unicode I dont think this should be the best practice for python.
    inp.upper()==inp seems more reliable IMO.

  • Custom User Avatar

    Not shure if this qualifies as best practice, but I like how this solution avoids a nested loop.

  • Custom User Avatar

    I have yet to give this kata a second try since I am here to improve on my language skills in python and not on my math skills, I usually avoid katas which require a mathematical solution.

  • Custom User Avatar

    I think a standard for loop is the Best Practice and most readable way to do it. However this list comprehension seems to me like the most "pythonic" answer.

  • Loading more items...