Ad
  • Custom User Avatar

    Did not realize this had started an entire thread on commenting practices. I used this exercise when I was teaching coding years ago, as an example of how pseudo-coding can help you think through a solution without writing code immediately. I encourage students to think through what the problem is and the steps they would need to solve it, then write those as comments. Then you can fill in the lines underneath the comments with actual code to make it like a "paint by numbers" exercise. In a real world scenario, I would then remove the extraneous comments and only leave ones that are necessary to explain complex or unexpected operations.

    Didn't expect feedback, and wasn't asking for any.

  • Default User Avatar

    I strongly disagree with the other feedback on your comments. Descriptive commenting is a great example of best practices, and while it is not very common on Codewars, in the professional world it is going to make your code infinitely more workable and readable. You will stand out to employers, your co-workers will appreciate you, and when it comes time to modify/update a past project, you and/or your co-workers will not have to waste time reverse-engineering your code just to figure out what each variable and code block did in the first place before you can even begin to make any progress. It will make you more efficient and productive in the long run, especially on large-scale projects.

    It's true that you are indeed giving some very rudimentary comments, which could potentially be improved upon--something which the others have unproductively alluded to. If you are trying to help remind yourself or to teach others some of the things you've learned along the way, you could try to include some more descriptive details, such as what exactly pushing the integer to the array does (adds an element to the end of the array with that integer value) or what returning the result does (allows you to retrieve that value or object when you access it through a call to the function, often based on the input sent through its parameters).

    Most importantly, don't ever let anyone convince you that you've worked too hard, even if you've made a mistake, or many. Those are opportunities to learn. Learn everything you can from them. They will always make you better, and never doubt that you were right to try fearlessly.

    But the only thing that people who try to cut you down to their size should teach you is just how much smaller they intend to stay.

    Codewars Code of Conduct

  • Default User Avatar

    this solution passes the test cases but not the specified criteria. the criteria says it should be case-insensitive.

    this solution only works for alligator and ALLIGATOR. it would fail if AlLiGaTOR or any other version were tested

  • Default User Avatar

    More comments of course would make this better. You know, a few talking about what each bracket does...

  • Default User Avatar

    This solution is over commented. There are comments that are obvious and are not neccesity to be specified.