Ad
  • Default User Avatar

    no but cant see a pattern or any description.

  • Default User Avatar

    I tried to compete in code colfing by the past, not the first by a long margin!
    They are many tricks involved and even languages optimized for code golfing.
    Code golf is quite a common game: even on CW you can find code golfing kata

  • Default User Avatar

    First of all, thanks both of you for the kind words.

    Then, akar-0 is right about this kind of solution:
    For simpler kata, I tend to do code-golfing - aka. solving a problem using as few characters as possible.
    These solutions are certainly not the most readable and not the most maintainable but they are meant to push Python language to its limits:
    While doing so, I learnt a lot on Python itself and its interpreter.
    Nevertheless for harder kata, I try to write readable code (and sometimes documentation) as the very logic is not easy to understand.

    Now to answer mitron6's question, I'm also a professional Python developer and for sure, I'm expecting not to maintain such code in production.
    There are standards for work environment that you should follow at all costs.
    However Codewars is more recreational for me:
    It brings me challenging problems that I'm not seeing everyday so I can learn from them.
    When katas are not hard enough, I like to add an additional layer of complexity by code-golfing or by writing a non-standard solution: from time to time, it brings other warriors an interesting piece of code to dissect ;-)
    And about my level: I would just add that I'm a curious developer doing Python since 8-9 years.

  • Custom User Avatar

    I am an admirer of lechevalier, I learnt many things about Python dissecting his solutions. However, I believe it's a game for him to write extremely dense code, and certainly not a maintanable one from a professional point of view.

  • Default User Avatar

    Thank you.

    Yeah, you're right. I tested it too and it worked; but I must have just gotten lucky on the random tests when testing on Python 3.8. I'm not sure how the solution passed when I wrote it. Possibly I did it in beta, and got lucky with the new tests; or just got lucky the first time.

  • Default User Avatar

    That is not strictly correct. Whether the solution passes all tests is dependent on Python version. As of Python 3.8, the solution passes all tests. Some changes I haven't looked into cause it to fail using Python 3.10.

  • Custom User Avatar

    Found one! It's pretty easy really. I just haven't used Python much lately...

  • Custom User Avatar

    Oh, you're right! Python 3 lambdas don't deconstruct tuple arguments anymore. That's a bummer. I played around with the program a bit, but I didn't find a way to make the code as nice and compact as it was... :-(

  • Custom User Avatar

    it may be bad behavior in C, but not in JS. also, golf challenges will never be best practice.

  • Default User Avatar

    Oops, I missed that, sorry.

  • Default User Avatar

    'alr approved some time ago'

  • Custom User Avatar
  • Default User Avatar

    Approved

  • Custom User Avatar
  • Custom User Avatar
  • Loading more items...