3 ms·
reduce(lambda x,y:x+y, map(lambda x:x*x, range(1,6)))
by ecounysis 15y ago
reduce(lambda x,y:x+y, map(lambda x:x*x, range(1,6)))
- mjmahone 15y agoMuch more effective, and doesn't botch the code. The blog post's code would actually return 16, due to reduce being a fold left, and the sum function incorrectly being x+x.