Ad
  • Default User Avatar

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

  • Custom User Avatar

    it's short, but the filter function call is equialent to [c for c in x if str.isdigit(c)] which has the disadvantage that it will go through the whole word and create an array even if there's only one digit and it can be the first character in the word. If we change the call to filter into this:

    next(int(c) for c in x if c.isdigit()) this will create a generator which will in this usage will stop on first digit found...

  • Default User Avatar

    @CrazyMerlyn:
    Oops, didn't thought about it, my bad :p

  • Custom User Avatar

    @acaccia, a solution or spoiler should be marked spoiler even when discussing it on a solution thread.
    While someone who hasn't solved this problem can't access the solution, the comment is still visible on the home page.

  • Default User Avatar

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