Ad
  • Custom User Avatar

    could you please tell what pattern, I have to search

  • Custom User Avatar

    Check boroda_29's post below.

  • Custom User Avatar
    1. what version of Python did you run it with in your environment?

    2. what version of Python did you run it with on Codewars?

  • Default User Avatar

    There are almost always closed form solutions for sums of numbers.

  • Custom User Avatar

    Never mind. I didn´t put the name of those algorithms. There is a very important tool for a programmer when integer sequences are involved.
    www.oeis.org

  • Custom User Avatar

    Remember that Brute force algorithms can´t solve all the challenges and as I wrote below, "Try to study a math pattern in the triangle to speed up your code."

  • Default User Avatar

    There are 2 things you can look into. Currying which allows you to pass in multiple seperate args, however due to this problem giving an unknown number of args, maybe try solving it using classes instead.

  • Custom User Avatar

    Python - I think one of the randome test still have the actual and expected value mixed up in the assert. There is always one random test that says my expected value is incorrect, so I run my code in an ide with the failed input and it returns the proper value.

  • Default User Avatar

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

  • Default User Avatar

    (yeah, still not in bed... :-/ Thanks to Dinglemouse and his "Soundex"... ;) )

    ZZzzzz

    :-)

  • Default User Avatar

    HAHA! Second french guy I cross path with, on codewars! ;)

    About your code, you've got a misspelling error in the definition of spin2 : spins[i], not spin[i]. CW didn't raise an error because the variable spin is defined in the tests cases, so you didn't use the argument of your function but a variable in a larger scope. With that, all will be good. ;)

    Happy coding on CW!

  • Custom User Avatar
  • Default User Avatar

    Could you paste the full code you are using ? (yeah, still not in bed... :-/ Thanks to Dinglemouse and his "Soundex"... ;) )

    Note: which part of Europe or Africa ? (personnaly: bread, wine, beret and Eiffel Tower... ;) )

  • Default User Avatar

    The point of enumerate was to write: spin2 = [reel[spin[i]] for i,reel in enumerate(reels)] It's more verbose, so the code is easier to follow. But it's more verbose... And effectively, your modification makes sens too, with the range(3).

    About the "new info", considering that many guys did pass the kata without problems, could you have read the log of the following or previous test, actually ?

    EDIT : Hu... I forgot the way the random tests are dsplayed... I'll take a look, but I'm really tired, right now (it's midnight on my side of the world... ;) )

    EDIT²: checked. Your algorithm is good. It should pass the tests (it did on my side!) If it's not the case, check the modifications you did that you didn't talk about in your previous message: your problem lays there, right now.

    I'm going to bed, cheers!

  • Default User Avatar

    Ok. Think about what could be spin2 when set(spin2) gives you something like {'Wild', 'Queen'}...

  • Loading more items...