project-euler/0006.py
2018-03-26 16:10:03 +02:00

20 lines
353 B
Python

from functools import reduce
def square_sum(rng):
sum = reduce(lambda x, y: x + y, rng)
return sum ** 2
def sum_squares(rng):
squares = list(map(lambda x: x**2, rng))
return reduce(lambda x, y: x + y, squares)
lst = list(range(1, 101))
result1 = sum_squares(lst)
result2 = square_sum(lst)
print(result2 - result1)
# print(result)