Sum of first n cubes: Difference between revisions

Content added Content deleted
(→‎Python :: Functional: Inlined call to itertools.accumulate)
Line 1,397: Line 1,397:
'''
'''
def go(a, x):
def go(a, x):
return a + (x ** 3)
return a + x ** 3


return accumulate(range(0, n), go)
return accumulate(range(0, n), go)