Computer Science, asked by chopperlapavan143, 10 months ago

Fill in the empty function so that it returns the sum of all the divisors of a number, without including it. A divisor is a number that divides into another without a remainder.

Answers

Answered by ashikurrahman068
8

Answer:

def sum_divisors(n):

 return sum([i for i in range(1, n)

               if n % i == 0])

Explanation:

just in range of n. mod it and add in the sum value

Answered by priyarksynergy
3

def sum_ divisors(n):

   s = 0

   for i in range(1, n):

        if n%i == 0:

            s += i

   return i

Explanation:

def sum_ divisors(n):

   s = 0

   for i in range(1, n): (run a loop till n, exclusive)

        if n% i == 0:   (a divisor divides the number completely)

            s += i

   return i

Similar questions