def perfect(x):
factor_sum = 0
for i in range(1, x-1):
if x % i == 0:
factor_sum = factor_sum + i
if(factor_sum == x):
return True
return False
print perfect(6) #Prints True
print perfect(12) #Prints False
print perfect(28) #Prints True
solved Answer by python language [closed]