A solution in the spirit of the post using itertools:
>>> from itertools import islice,count
>>> sum(x*x for x in islice(count(1),10))
385 >>> from itertools import islice,count
>>> sum(x*x for x in islice(count(1),10))
385No comments yet.