Ad
  • Default User Avatar

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

  • Default User Avatar

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

  • Default User Avatar

    Ah yes, I see what you mean about the performance issues. While it works fine with the simple examples in this kata, it would not scale well.

    Thank you for sharing your thought on this!

  • Custom User Avatar

    It is not totally bad, but has some performance cave-ats which could be potentially improved.

    For example, how many times the s.lower() is called? It also does a lot of unnecessary work for inputs like "A" * 1000 + "B" * 1000 + "C" * 1_000 ... + "Z" * 1_000.

  • Default User Avatar

    Are there issues with this solution that prevent it from being more highly rated as best practice? To me, this is the simplest and easiest to read.

  • Default User Avatar

    My comment/solution was silly, impractical, and not in the spirit of the Kumite you created, so no need to apologise or thank me :D

  • Custom User Avatar

    I see what you're saying ~ I apologize I didn't undertsand sooner. So, when I designed this kumite I was conceptulizing a very simple str formating exercise where the user had to strip dashes (-) from the input paramter before searching within the given constant PI (in the preloaded section) which only contains 1 million decimals. So becausse this given PI constant is finite, there are combinations of 6-8 digit numbers not found within it, as proven with the test cases. However, I concede to your point, true PI is infinte, and would be difficult to prove if a 6-8 digit number exitsed within it! Again, I apprecate the feedback!

  • Default User Avatar

    Hi seraph776. I made the def happy_pi(birthday): return True suggestion solution mostly in jest, but some people might consider it a valid solution.

    If we assume a valid input (a valid date; not "foo") and that the irrational number pi has infinite decimal places, then it could be argued that any 6-8 digit number will appear in pi. At the very least, it would be difficult to prove that the 6-8 digit number does not appear in pi.

  • Custom User Avatar

    Thanks for your feedback! Help me uderstand how does your code test for birthday in PI? The input paramter is a str, and your code will returns True no matter what the input argument is. For example, if the input value was "foo", then this code would return True, which is False because "foo" is not in PI, correct? Let me know if I am missing anything. Again, thanks for your feedback! ~ Respectfully.

  • Default User Avatar

    If the input is assumed to be valid and pi is assumed to have an infinite number of decimal places, then the following could be assumed to suffice for the "is my birthday in pi?" question:

    def happy_pi(birthday):
      return True
    
  • Default User Avatar

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

  • Custom User Avatar
  • Default User Avatar

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

  • Default User Avatar

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

  • Default User Avatar

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

  • Loading more items...