Ad
  • Default User Avatar

    I like the katana, but i missed some information for the "rules of scoring". I'm not familiar with tennis sport itself, but thanks to the katana i searched for some more information about counting in tennis. Maybe it would be nice to enhance the rules with:
    A fourth point win by a player decides the game for him if the player then has a lead of at least two points, i.e. after the scores 40:0, 40:15 and 40:30 (or vice versa). If the score is 40:40, it is called a deuce. The following point is called an advantage.

  • Default User Avatar

    It's generally considered as bad practice to mutate the input.

  • Default User Avatar

    Thanks for your help. I updated my code and now it is working. Now i also understand the test itself. You used the same list for a couple of tests, that's why my modification had this strong influence to the further tests. I'm sorry. I will keep this in mind for furhter katas.

    Would you recommend to work always on a copy of the inputs?

  • Default User Avatar

    The tests are OK but you should not modify the input list ls; work on a copy of ls. Moreover there might be some other problems in your code.

  • Default User Avatar

    Hi g964, i did what you said and printed the first element of ls with print(ls[0]).

    I got this:
    Traceback (most recent call last):
    File "main.py", line 26, in
    Test.assert_equals(choose_best_sum(880, 8, xs), 876)
    File "/home/codewarrior/solution.py", line 2, in choose_best_sum
    print(ls[0])
    IndexError: list index out of range

    Can you please check the tests, there must be something wrong.

    greetings EScoder

  • Default User Avatar

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

  • Default User Avatar

    There is nothing messed up in the tests: look at the top of the page to see how many people passed the Python kata.

    Bigger numbers: 880 8 [] --> first the list of distances is empty

    Print the list and you will see it is not empty.

  • Default User Avatar

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