Horje
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. Code Example
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.
def sum_divisors(n):
    return sum([i for i in range(1, n)
                if n % i == 0])

print(sum_divisors(0))
print(sum_divisors(3)) # Should sum of 1
print(sum_divisors(36)) # Should sum of 1+2+3+4+6+9+12+18
print(sum_divisors(102)) # Should be sum of 2+3+6+17+34+51




Python

Related
model evaluate function Code Example model evaluate function Code Example
how to downgrade python 3.9 to 3.8 Code Example how to downgrade python 3.9 to 3.8 Code Example
how to do an if input = python Code Example how to do an if input = python Code Example
pyqt5 close event Code Example pyqt5 close event Code Example
change text in legend matplotlib Code Example change text in legend matplotlib Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8