Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
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!
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
.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.
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
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 constantPI
(in the preloaded section) which only contains1 million
decimals. So becausse this givenPI
constant isfinite
, there are combinations of6-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!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.
Thanks for your feedback! Help me uderstand how does your code test for
birthday
inPI
? The input paramter is astr
, and your code will returnsTrue
no matter what the input argument is. For example, if the input value was "foo
", then this code would returnTrue
, which isFalse
because "foo
" is not inPI
, correct? Let me know if I am missing anything. Again, thanks for your feedback! ~ Respectfully.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:
This comment is hidden because it contains spoiler information about the solution
looks good
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Loading more items...