def sum_cubes(n):
if n <= 0:
if n < 0:
raise ValueError
else:
return 0
else:
return n ** 3 + sum_cubes(n-1)
if __name__ == "__main__":
print sum_cubes(10)

and a non recursive way

def sum_cubes2(n):
if n < 0:
raise ValueError
res = 0
while n:
res += n ** 3
n -= 1
return res

APLX is a very complete implementation of the APL programming language from MicroAPL. The company stopped producing it in 2016 and it has been taken over by Dyalog. While Dyalog ...