generate functionTue, 07 Mar 2023

The program receives a natural number N as input. We need to find the sum of its divisors.

def divisors(n): a = [] for i in range(1,n): if n % i == 0: a.append(i) print(sum(a)) return a divisors(120)

Questions about programming?Chat with your personal AI assistant