Ad
  • Custom User Avatar

    also the short versions will usually pop up as the first - meaning those that dont plan on looking through lots of different solutions will just drop their vote on the first clever-looking solution they see, and move on.

  • Custom User Avatar

    I'm pretty sure this one-liner will get you failed in a google interview. More than one "for" clauses in a list comprehension is not permitted per Google style guide 2.7.4. When things get complicated they'd rather see for loops, even though list comprehension has an internal overhead optimization (about 2x faster).

  • Default User Avatar

    damn, that runs fast

  • Default User Avatar

    Ok, thank you. I'll keep that in mind looking through solutions here.

  • Default User Avatar

    There's no "right" answer to your question. In Python, generally speaking, readability is valued above terseness (it's a driving aspect of the languages design and syntax).
    That said, you shouldn't look to kata solutions to find "good coding practice", unfortunately. Few people actually care, most just want to solve and move on. Shorter code is faster to write, obviously.
    As for "clever" and "best practices", those are ironically completely misleading, since short, confusing and "clever looking" usually attracts many votes from users who simply don't know better, even when the code, in practice, is terribly inefficient.

  • Default User Avatar

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