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)