>>> sum(x*x for x in xrange(1,11)) 385
>>> sum(map(lambda x: x*x, xrange(1,11))) 385
The C++ equivalent of your Python would be something like:
typedef boost::counting_iterator<int> ci; auto sum = std::accumulate(ci(0), ci(10), 0, [](auto x, auto y) { return x + (y*y); });
>>> from itertools import islice,count >>> sum(x*x for x in islice(count(1),10)) 385