Ad
  • Default User Avatar

    This is a good solution, but s.lower() will get called for every ch in string.lowercase until all letters have been covered or ch is not in s.lower().

  • Default User Avatar

    The square brackets are actually unnecessary here, without the square brackets you would have what's called a generator expression which works as an iterator on its own. The square brackets are only required when you need to use list functionality, for instance len().

    Just thought I'd tell you because I also did this for quite some time before I learned that you can go without it.

  • Custom User Avatar

    krishp, 6 years ago / was integer division in Python 2.7.

  • Default User Avatar

    I know that this is 6 years late, but your submission is correct and passes all the test cases. The reason it was failing was because in line 7 you have prime_factors(n/i). Since for loops require integers, if you change this to prime_factors(n//i) it passes everything.

  • Custom User Avatar

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

  • Custom User Avatar

    Agreed. This kata could be improved by prohibiting use of str.endswith().

  • Default User Avatar

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

  • Custom User Avatar

    Yeah!, You're right. I did't see that situtation. Well, the tests will be better..

  • Default User Avatar

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

  • Default User Avatar

    I think the 'in map' if/else conditional at the bottom of your move function will fail to catch the case where, e.g. you're at position 10 and try to move left. That should probably be checked for in the suite of submission tests, and perhaps I'm missing something obvious.

  • Custom User Avatar

    Description is too vague. The coder spends more time trying to guess what the author wants. A lot of information is missing or confusing. The discussion gives most of the details that still need to be fixed.

  • Default User Avatar

    I thoroughly enjoyed this Kata, but it could definitely use some clarity improvements.

    The Kata description should describe the Ball(object) and Ghost(object) classes, their attributes, and say that they are already implemented. I implemented my own Ball class and had started implementing my own Ghost class before I read the discussion and saw you had implemented them.

    Mention and link to your other Kata regarding creation of the Ball class. Perhaps there's a Ghost class Kata as well (if not, I'd love to see you make it!).

    As others have mentioned, inconsistent naming (and in particular the omission from the description of the Ghost.color attribute name) is a bit confusing for working up a solution.

  • Default User Avatar

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

  • Default User Avatar

    Hmm. Good point. Perhaps ball_type or ballType would have been better. :-/

  • Default User Avatar

    Ah, okay. That's more or less what I suspected, but I couldn't view the test cases prior to submission. Thanks!

    Do you know if that test exceeds the max recursion depth of default Python 2.7, or if it just times out due to codewars' solution time limit?

  • Loading more items...