Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

perfect number in python

def perfect_number(n):
    sum = 0
    for x in range(1, n):
        if n % x == 0:
            sum += x
    return sum == n
print(perfect_number(6))
 
PREVIOUS NEXT
Tagged: #perfect #number #python
ADD COMMENT
Topic
Name
4+2 =