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))
n = int(input("Enter any number: "))sum1 = 0for i in range(1, n):if(n % i == 0):sum1 = sum1 + iif (sum1 == n):print("The number is a Perfect number!")else:print("The number is not a Perfect number!")
def perfect(n):
f=[]
for i in range(1,n):
if n%i==0:
f.append(i)
if sum(f)==n:
print(n," is perfect")
else:
print("Not perfect")
n=eval(input("Enter number:"))
perfect(n)
n=int(input("Enter a Number : "))
c = 0
for i in range(1, n):
if n % i == 0:
c = c + i
if c == n:
print(n, "The number is a Perfect number!")
else:
print(n, "The number is not a Perfect number!")