Ad
  • Default User Avatar

    I am very new to codewars but this one was way too easy, felt more like 7kyu or so, is it possible to edit it and to add some more challanging code to it?
    If yes, would love to help with it.

  • Default User Avatar

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

  • Custom User Avatar
  • Custom User Avatar

    what about 1? It's late at night here and I'm a bit dizzy, but still I dare to say that 1 * 11 = 11 and that matches ? * 11 = ?? when ? is 1.

  • Custom User Avatar

    I agree: as a one liner, it is really neat and clever, but "Best Practices"? Low readability, low maintainability and low performance due calling lower and split functions for the two parameters in every iteration.

  • Default User Avatar

    No, you're just blind for... ;)

    (not my mother tongue either ;) )

  • Default User Avatar

    Mmmmmh...

    Adding that, it should work, I think:

    @staticmethod
    def expect(boolVal, message="FAILED TEST!"):
        if not boolVal: raise Exception(message)
    

    Note: the problem here is maybe that the print statments didn't need parentheses in python 2?

  • Custom User Avatar

    Well, English is not my mother tongue... and what it's even worse: I'm stupid.

    So, forget about that.

  • Custom User Avatar

    Hey Blind! I can always count on you... thanks!

    The problem is that these tests aren't even using assert_equals. Take a look at the "Show Test Cases" here, I just copied and paste that code. It calls test.expect(...).

    Nonetheless, I was doing things as you, the problem is that I commited a mistake when copying a test case and I've wasted a lot of time until I realize that. The best way to avoid this would be if I could just copy and paste the testing code published here straight forward as is.

  • Default User Avatar

    "... or (b) considered to be an exception and put entirely into lower case unless it is the first word, which is always capitalised."

    ;)

  • Custom User Avatar

    Either the description is incomplete, or this test case in Python is wrong:

    Test.assert_equals(title_case('THE WIND IN THE WILLOWS', 'The In'), 'The Wind in the Willows')

    According to the description, it should be:

    Test.assert_equals(title_case('THE WIND IN THE WILLOWS', 'The In'), 'the Wind in the Willows')

    shouldn't it?

  • Default User Avatar

    Hi,

    I'm not sure to understand what you want... :o

    If you want a way to make compatible your IDE implementation with the test class used on codewars (I think that's what you're talking about), I used that for big katas development:

    class Test(object):
        @staticmethod
        def it(message): print(" \n{}\n".format(message))
        
        @staticmethod
        def describe(message): print(" \n{}\n".format(message))
        
        @staticmethod
        def assert_equals(actual, expected, message="FAILED TEST!"):
            if actual != expected: raise Exception(message)
    

    On codewars, it's actually test.assert_equals but there is surely some aliasing somewhere, because that works with Test.assert_equals as I use in my code too.

    EDIT: note that you can add test=Test after that to avoid any troubles with capitalization between your machine and CW's sample tests for example.

  • Custom User Avatar

    Hey, a question about the test cases used here for python. I'm using Python 3, so maybe the problem is related to that, but when I just copy and paste these tests on my IntelliJ Idea I got "Unresolved reference 'test'" everywhere.

    I used to adapt those test cases to unittest.TestCase class, but with this very same Kata I've wasted a lot of time trying to debug an actually working code just because I commit a mistake when adapting the testcase, so I'd like to be able to use these tests as they are to avoid these problems in the future.

    Thanks a lot in advance!

  • Custom User Avatar

    I solved that Blind4Basics, but guess what: now I've another problem that I'm sure it is related to the infinite thing you pointed before. I hope to find some more time later to address this problem and settle it today.

    Thank you very much for your help.

  • Default User Avatar

    Yeah, this is a problem I know well enough too... (the "blind for basics" thing... ;-o )

    ;-D

  • Loading more items...