0

code of perfect number

while True: print ("enter num") x=int(input()) lst=list(range(x)) lst.remove(0) lst1=[] def per_num(x) : for i in lst: if not x%i==0: continue if x%i==0: lst1.append(i) if x/sum(lst1)==1: return (x, "is perfect") else: return ("not perfect") print (per_num(x)) https://code.sololearn.com/cH03buFQd3DQ/?ref=app

19th Apr 2018, 10:01 PM
moamen
moamen - avatar
3 odpowiedzi
+ 1
the question is how can I generate perfect nums in this code sorry for not mentioning it in post
19th Apr 2018, 10:17 PM
moamen
moamen - avatar