Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

perfect number code python

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)
Source by codingcompiler.com #
 
PREVIOUS NEXT
Tagged: #perfect #number #code #python
ADD COMMENT
Topic
Name
2+4 =