programming-examples/python/Math/Returns sum of all divisors of a number.py
2019-11-15 12:59:38 +01:00

8 lines
209 B
Python

def sum_div(number):
divisors = [1]
for i in range(2, number):
if (number % i)==0:
divisors.append(i)
return divisors
print(sum_div(8))
print(sum_div(12))