• Custom User Avatar
  • Custom User Avatar

    Not in a global but a class variable. That is you can reference it in your static method like so: Prime.primes.

  • Custom User Avatar

    yes, you would store it in a global variable. pretty sure the author of this Kata is not Python native...

    See the first comment on this SO post: http://stackoverflow.com/questions/7396092/is-there-a-static-constructor-or-static-initializer-in-python

  • Custom User Avatar

    I was doing this kata in JavaScript, and I believe the test that initially failed and then passed dealt with backstage passes. Unfortunately, I do not recall the input or output, as I was expecting to see that failed test a second time and didn't note it.

    In reference to giving the kata an "interview feel", I have had several interviews like this and am generally told that the purpose of the question is not only to see how the candidate solves the problem but how he/she interacts with the team/individual asking the question. These tend to be "social" or "culture" type questions, rather than hammer-at-it-until-it-breaks type questions. Generally, the purpose is to work collaboratively with those asking the question - which is not possible in this format.

  • Custom User Avatar

    I think the consecutio is pretty straightforward here: once the sell_in days is less then zero, quality degrades twice as fast, meaning first you check if it goes below zero, and in case the quality degrades 2X, doesn't it?

  • Custom User Avatar

    In Python, since Primes.first() is called without instantiating an instance of the Primes class, I believe we have to define first as a static method. If this is not the case, how else could it be written such that the first Primes.first() does not throw an error?

    Then the next question I've been struggling with...if it's a static method without an instance of a class, where would you store the previously calculated values from memoization? In a global variable? Thanks in advance

  • Custom User Avatar

    Nice kata I enjoyed this one. Just a suggestion on the problem description and/or order of operations:

    When calculating the change in value for an item on a given day you first need to decrement the "sell in" field. So for instance to calculate whether a product will decay twice as fast, you actually need to check if the sell in field is equal to one at the start of the loop for the day. I think this should be made clear in the problem description, or personally I would change it. The way the problem description is written seems to imply that the change in daily quality values are calculated using the current "sell in" value.

  • Custom User Avatar

    Thanks for your post!

  • Custom User Avatar

    Sorry I figured it out. My browser (chrome) was just not rendering the strings "LEFT BRACKET name RIGHT BRACKET" when I tried to print them, but was properly rendering them in the project description and the provided print statements. I don't know HTML so that is probably some sort of special combo.

  • Custom User Avatar

    Please could you be clearer, I don't understand very well your problem:-(

  • Custom User Avatar

    Hi, I this there is an issue on this test using Python. I was using strng.splitlines() and each substring was correct except the "" elements were mysteriously missing from each new string. When I tried simply returning the original phonebook string with no modification I saw the same thing - the "" elements were missing in the string as well.