4 ms·
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
by father_of_two 11y ago
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