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.
I agree with you that this problem could become more challenging by adding test cases with some large perfect powers. However, I tried your solution on
isPP(7078198741908749 ** 3)
and it returnedNone
.I like this the best. My solution was a single line as well, but I think this is perhaps the best way to do this. I didn't realize you could separate the arguments in this way. Good to know for next time!
Whatever the mathematical definitions, this kata's talking about determining if building blocks can be arranged in squares vs. rectangles. If you have 0 blocks, you can't arrange your lack of blocks into a square. ;-)
*sigh*, I should have added some corner cases. :/.
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
You are correct sir. I had an off by 1 bug in the remainder. Thanks!
See the fix I posted above needed for the Python test code to properly call randint
I did the same error once: putting my own code as solution code, then comparing it with itself.
Apparently your test code generates floats, which is not meant to happen, but to show you my code, I'll put it in the following answer with spoilers, hoping you can read it; if not, I'll try cheating on this exercise to show you the code as commented in the solution that passes the test.
The third example test case, f(15,10)=60, seems pretty fine to me.
Your test in Python is broken because you implemented your own version of randint that returns floats. Semicolons aren't used in Python either. Please fix as below:
from random import randint
n, m = randint(min, max), randint(min, max)