Ad
  • Custom User Avatar

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

  • Custom User Avatar

    Great solution but variable naming and formatting could be improved to, combined with a docstring, turn it into really good production code.

  • Custom User Avatar

    I don't understand why this is getting so many good votes. Probably because of the commenting. But:

    1. The comments are just parroting what the code is doing - this is totally redundant and very bad practice as you now have to maintain code in sync with comments (and/or vice versa).
    2. Misleading variable naming: 'person' is initially just a string that may or may not be discarded depending on length. Only after the 'if' statement do we know it is actually a 'name' per the specification (4 chars), therefore presumably a 'person'.
    3. A list comprehension would be easier to understand for a maintainer and execute faster than initialising an empty list and then using '.append'.
    4. The test cases don't catch it but what about strings that are just numbers (e.g. "12" or "567894")? (Granted, "ArXx" isn't exactly a 'name' either but qualifies according to the spec. "2345" does not qualify per spec but passes the tests.)
  • Custom User Avatar

    ';' in Python, especially in these cases??
    "nein" when raising an unspecified exception - with an international (mostly English) audience/developer/user group?