[Solved] Compute the ratio of the sum of cube of the first ‘n’ natural numbers to the sum of square of first ‘n’ natural numbers


from functools import reduce
import ast,sys
input_int = int(sys.stdin.read())

num_list = [x for x in range(1, input_int+1)]
print(reduce(lambda x, y : x + y ** 3, num_list) / reduce(lambda x, y : x + y ** ,num_list))

1

solved Compute the ratio of the sum of cube of the first ‘n’ natural numbers to the sum of square of first ‘n’ natural numbers