Ad
  • Custom User Avatar

    The whole point here is that it's not a list comprehension.

    If it were a list comprehension, then the whole list would be built, and all would be called on it afterwards. But it's a generator comprehension, which produces elements lazily, one by one, as they are iterated over.

  • Custom User Avatar

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

  • Custom User Avatar

    Yeah, I think I can maybe be a little more liberal with my one-liners.

  • Custom User Avatar

    I use them so long as they are easily understandable (like this one)

  • Custom User Avatar

    Nice one liner. Just currious, do people use if statements like this in production? Thanks!

  • Custom User Avatar

    Check this comment thread. Hint: maybe there's another data structure you can try using.

  • Custom User Avatar

    I don't understand, I can only pass all the cases on the attempt if I return a leaderboard with size 501 but I get an out of bounds error with size 500. How do I return a list of size 500 with 500 objects but the indexes have to start at 1?

    Also, Im getting this error:

    The code that caused this warning is on line 52 of the file main.py. To get rid of this warning, change code that looks like this:

    BeautifulSoup(YOUR_MARKUP})

    to this:

    BeautifulSoup(YOUR_MARKUP, "html.parser")

    markup_type=markup_type))

    my code looks like this: soup = BeautifulSoup(page.content, "html.parser")
    why is that wrong?

    Thanks

  • Custom User Avatar

    Would fail some of the comparisons because the test functions build lists that don't end in an empty node, yet some of the inputs are lists that end in an empty node. Those two are not equivalent so I had to traverse the list and change the empty node to None (Python). Let me know if I just missed something and this isn't an issue.

  • Custom User Avatar

    you can save some space by changing the last 4 lines to: return (s == ending);