Ad
  • Custom User Avatar

    not an iterator. if you leave the braces you have a generator expression ;-)

    simple change, but bigger meaning: with the braces you create a list, save it into memory and sum that afterwards. without the braces the list will be generated and not stored in memory.

    that won't be a problem with small lists, but with bigger ones a generator expression is more efficient

  • Default User Avatar

    Thanks, you are right. Iterators are definitely better.

  • Custom User Avatar

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