xxxxxxxxxx
a=int(input("Give a number: "))
sum=0
for i in range(1,a):
if a%i==0:
sum=sum+i
if sum==a:
print(a,"is a perfect number")
else:
print(a,"is not a perfect number")
xxxxxxxxxx
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))