Ad
  • Default User Avatar

    para este taka no veo necesario importar la libreria, solo tienes que multiplicar numero x numero, mira mi solucion, espero te ayude

  • Default User Avatar

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

  • Custom User Avatar

    How is this a 7kyu?

  • Default User Avatar

    I copied a list in the beginning of the function but it still says I mutated the initial list

  • Default User Avatar

    No I tested different numbers, because I haven't noticed test numbers... I tested 5, 27, 9, 25, 81, and few similar examples and they all worked correct and now actually tried with -1 and there is a bug, thanks.

    At the end I can say that there was only one exception for -1 and the rest works correct... Thanks for your answer, I finally solved!

  • Custom User Avatar

    But what numbers do you test in your local Python interpreter? Do you test the same numbers as Codewars does? Did you test is_square(-1) (which you can see in the error message)?

  • Default User Avatar

    Sorry about that issue mark, I'm first time here.

    As I understood problem is that here interpreter shows kind of mistake which never happens at least with my local Python interpreter.

  • Custom User Avatar

    Anyway, it is a question, not an issue (yet).

  • Custom User Avatar

    Are you testing it there with that input value?

  • Default User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

    You modified the original array at the line copyNumbers.splice(indexMin, 1).

    The issue with your solution is that you're mutating the original array, even though the task requires you to avoid this. When you assign copyNumbers = numbers, you're creating a reference to the original array, not a copy. Modifying copyNumbers will therefore also modify numbers.

  • Custom User Avatar

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

  • Default User Avatar

    Hint: you cannot copy a list by typing list2 = list1, because list2 will only be a reference to list1

    Took me a while to figure it out, but a very valuable lesson

  • Custom User Avatar
  • Loading more items...