# Python Program to Check Perfect Number

#### This python program checks whether a given number is perfect number or not.

A perfect number is a positive integer number in which sum of all positive divisors excluding the number itself is equal to that number.

Perfect Number Example: 28 is perfect number since its divisors are 1, 2, 4, 7 and 14. Sum of divisors is: 1+2+4+7+14=28.

List of Perfect Numbers: 6, 28, 496, 8128, ...

## Python Source Code: Perfect Number Check

``````
# Python program to check Perfect Number

# Function to check perfect number
def is_perfect(n):

perfect_sum = 0

for i in range(1,n):
if n%i==0:
perfect_sum += i

return perfect_sum == n

number = int(input('Enter number: '))

# Function call & Decision
if is_perfect(number):
print('%d is PERFECT' %(number))
else:
print('%d is NOT PERFECT' %(number))
``````

## Check Perfect Number Python Output

```Run 1:
--------------
Enter number: 496
496 is PERFECT

Run 2:
--------------
Enter number: 342
342 is NOT PERFECT
```