Ad
  • Custom User Avatar

    If you are going to test for an exception being thrown, you should probably edit the problem description to not specifically state that the code should return False for illegal inputs. Also, references to 'true' and 'false' should be changed to True and False for any Python kata.

  • Custom User Avatar

    That depends on whether you trust the problem description or the example test cases. The problem description specifically says to return False (actually, it says to return 'false', but that's the kind of sloppy error I've come to expect on this site). The example test cases, however, check for an error to be thrown. You have to throw an error for the tests to pass, making your code explicitly not correspond to the problem statement.

  • Custom User Avatar

    That was the issue I had. Which is aggravating and, in my opinion, very bad form. First the problem implies that the strict definition of what qualifies as an ObjectId comes from the MongoDB documentation. Then, it turns around and throws in an arbitrary requirement, while still omitting any other description of requirements. It should at least include a statement like 'Your function should test whether s is a valid Mongo ObjectId which conforms to an additional arbitrary restriction described below.'

  • Custom User Avatar

    This kata is actually really offensive and should be removed. This is absolutely not something a Python developer should 'practice' under any circumstances. It will actively make them a worse developer. Shadowing 'list' with a user-written class is near to one of the worst things a Python dev could do. I'm very disappointed to see this kata on the site. It might be appropriate for Ruby or JS or C# with its extension methods, but it has no place anywhere near Python.

  • Custom User Avatar

    Even better would just be doing return l or '{0} is prime'.format(integer) at the end.