Q:

Write a Python function to check whether a number is perfect or not.

0

Write a Python function to check whether a number is perfect or not.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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))

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now