Ad
  • Custom User Avatar
  • Custom User Avatar

    This is the only useless comment I see. As a beginner, you are taught to use comments in this way to get in the habit of using comments to explain what your code is doing.

  • 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
  • Custom User Avatar

    Nice explanation :)

  • Custom User Avatar

    Really Good use of Comments and Useful Naming on your variables.

  • Custom User Avatar

    Comments are good for other beginners, and for yourself when looking back over your code 👍

  • Custom User Avatar

    Useless comments