Ad
  • Custom User Avatar

    The kata is still not novel at all.

  • Custom User Avatar

    It's not a duplicate if there isn't a 101% identical kata

    That's not how it works.

  • Custom User Avatar

    no, you didn't get the idea. Currently, you have most of the tests that are predictable: the first random will be the most probable answer, and the following ones will always give the same result. That's way too much predictable.

    What you need is something like that:

    for _ in range(100):
        strategy = random.randint(0,3)
        if strategy==0: # pick one number randomly
        elif strategy==1: # build a square
        elif strategy==2: # build a palindrome
        else:             # build both at the same time.
    

    Note that the way you currently build the squares, there are a lot of chances that then can be identified just by checking the value: if it's > 1000, the user will know it's a square. So you actually need something like int(randint(1,...)**.5)**2, and you should use an upper value that is higher than 1000. For the square palindromes, just store a long list of those numbers and pick randomly inside it when you need one of them.

    Final note: you shouldn't resolve the issues unless you're absolutely sure that you actually resolved the problem. You already did that twice in a row without actually solveing the problem... ;/

  • Custom User Avatar

    I've updated the random tests so that there are always some squares, palindromes and palindromic squares.

    I suppose there's still a small chance that in a given attempt all the randomly generated squares happen to be palindromes, and all the randomly generated palindromes happen to be squares. I could put a while to make sure each strategy is randomly tested at least once, but I think that is stretching the point.

  • Custom User Avatar

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

  • Custom User Avatar

    Yes, apologies for that mistake, and thanks for catching it. I've changed the sample test value.

  • Custom User Avatar

    Checking for palindromes, and checking for square numbers are not novel ideas.

  • Custom User Avatar

    test.assert_equals(cat_ning_kole( 100 ), 'Darlin, je vous aime beaucoup', 'Failed to identify a number that is neither a square nor a palindrome')

    I'm positive that 100 is indeed a square.

  • Custom User Avatar

    ok, you have random tests, but I bet I can pass them returning only 'Darlin, je vous aime beaucoup' ;p
    => you need to randomly choose the strategy of the tests (inside the loop) and sometimes generate on purpose one of the other output. ;)

  • Custom User Avatar

    well, there is no real absolute guideline. That point was rather a matter of personal taste, yes. But when the output domain is restrained, I like to be able to see all the possible output.

    guideline: https://github.com/Codewars/codewars.com/wiki/Kata-Creator

  • Custom User Avatar

    Ah I see, I've added test cases for the other two types of input.

    I had deliberately left them out as the katas I've done in the past don't usually give you a complete set of test cases. Are there some guidelines for this sort of thing? (This is the first kata that I've authored.)

  • Custom User Avatar

    no I meant that you only test for 2 kinds of output in the sample tests, so the 2 others are lacking. ;)

    cheers

  • Default User Avatar

    Lovely St Valentine's FizzBuzz :-*

  • Custom User Avatar

    Hi Blind4Basics,

    Thanks for your comments. I've swapped the assertions around, and I'll add some random tests shortly.

    I don't understand your third comment, what are the outputs that are lacking? Do you mean the third optional argument to assert.test_equals? I'll add a message for each example.

    Have a nice day

  • Custom User Avatar

    Hi,

    • actual and expected are swapped in all the assertions
    • you need to put some random (or at least randomized) tests in addition.
    • you should add the two outputs that are lacking in the sample tests.

    cheers