Ad
  • Default User Avatar

    Thank You. That was a really concise explanation.

  • Custom User Avatar

    Okay, thanks. I understood

  • Custom User Avatar

    Yes, and no.

    Because of some specifics (which are partially explained in docs), usually kata have two kinds of tests which are run when you hit the ATTEMPT button: so-called "fixed tests", and so-called "random tests". Fixed tests are the same every time. Random tests are generated separately for every test run. Ideally, when a solution has some bug, there should be always at least one fixed test case which fails every time on wvery run of the solution, accompanied by at least a few failing random tests, which can be different every time. This is an ideal situation. But it happens quite often that coverage of the fixed test is either neglected by authors, or difficult to ensure for some types of problems. In such case, it can happen that your faulty solution will pass all fixed tests, but can fail some randomly generated tests. As a result, you will see no pattern between failed test runs.

    This is one possible explanation of the behavior you observe. Other reasons are also possible, but we cannot say anything for sure without seeing your code.

  • Custom User Avatar

    No no, I didn't mean that. I mean if I run the same code more than once the test cases that failed should be same but each time I run the code there is a change of failed test cases.

  • Custom User Avatar

    In a class, there are three types of methods: instance methods, class methods, and static methods. Instance methods are defined with a mandatory parameter self, alongside any other required parameters. For class methods, we use the @classmethod decorator before the method and include a mandatory parameter named cls, along with other parameters. Static methods, on the other hand, don't require a decorator and function like normal Python functions without needing a mandatory parameter. When written within a class, they behave as static methods by default, but you can add clarity by using the @staticmethod decorator. Remember it's common practice to use decorators and highly recommended.

  • Default User Avatar

    Why did you use @staticmethod on top of all the functions? (I am a newbie so pardon my questions)

  • Custom User Avatar
  • Custom User Avatar

    Yes, this is the whole meaning of "random tests".

  • Custom User Avatar

    weird! same code ran twice but different test cases failed!!!!!!!

  • Custom User Avatar

    No chromosome is written like this, X comes first then Y.

  • Custom User Avatar

    Not good practice as it should be simple and readable

  • Custom User Avatar

    this not good good practice when it's not rot13 case

  • Custom User Avatar

    Double is used for slicing not indexing

  • Custom User Avatar

    In your problem I don't think you need a constructor(you can pass) for your given tasks.

  • Custom User Avatar

    I was trying to do some silly code which was enefficient but seeing this solution I'm really impressive that how people think out of the box!

  • Loading more items...