Ad
  • Custom User Avatar

    Bravo!!!! Well done, this was a great kata. I learned a lot, had never done any web scrapping, so bit of a right of passage. If you are thinking of whether to do this Kata, I could not recommend it more. Also looking at the Kata test cases after solving it is well worth your time, some great code.

  • Custom User Avatar

    I solved it this way, but going down instead of up so it took an extra iteration through the last list, but this is just the definition of elegant. Well done.

  • Custom User Avatar

    hahahaha i have never been more surprised at an answer. nicely played.

  • Custom User Avatar

    Love the "#oh snap", well played.

  • Custom User Avatar

    Yeah, I can attest to that, in retrospect I shouldn't have voted up things that I did. I have basically stopped voting as I just can't see voting up a solution until I have a much better grasp of the language to be able to judge between solutions, so perhaps in like a decade I will start voting again :). But yeah my idea of what is "best practices" has changed a lot and as I have only been coding for 2 years, will I am sure continue to evolve.

    One of the things I have started doing is going on the leaderboard and finding people on there that are ranked high in the language I'm learning and following them. Then when you get to the solution page after I check out the top rated ones, I click on the "see solutions of people you are following". This way you often get to see quite quickly how someone who is a dan or a 1kyu coded the solution. I hadn't been using the "follow" feature, but it is definitely helpful.

  • Custom User Avatar

    Very clever, well done.

  • Custom User Avatar

    Hey John, funny I came on here as I noticed some of the solutions didn't account for when the triple and the double are different, and I see you already caught it. Nice solution by the way.

  • Custom User Avatar

    Thanks for the reply and completely agree that efficiency isn't everything, but merely one of several factors to consider.

  • Custom User Avatar

    Thanks, didn't realize that it was visible outside of solutions.

  • Custom User Avatar

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

  • Custom User Avatar

    Though I like this one, I would argue that it is extremely inefficient and is not "best practices". I would argue that because a string is immutable as you build the string here (called "result" in the above code) under the hood the string is getting rebuilt every time you add something to it. Much better to initalize a list of the same length as string then insert the elements into that list as you go and do a "".join() at the end. If anyone disagrees with this I would like to hear your reasoning.

  • Custom User Avatar

    Basically anything that is not a keyword or a built-in. So str, int, float, list, tuple...etc should not be used as a variable/parameter name as they are all built-ins, sure python is so flexible that you can do it, but I have definitely gotten this advice from more seasoned python users. If you want to see all the bulitins just type dir(builtins) and it shows all of them.

  • Custom User Avatar

    Agree that is a great way to do it, thanks for teaching me something new. I voted this up as "best practices" as it is much better than the current #1. Would be great to see the more efficient code get voted to teh top instead of the one-liners.

  • Custom User Avatar

    I just asked for one on the feature request page, go there and vote up my comment if you want to see this. It really is needed to stop these really ineficient algos from making their way to the #1 spot just because they take up fewer lines.

  • Custom User Avatar

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

  • Loading more items...