sumElem无返回值
def sumElem(n):
sum = 0
for i in range(1,n):
if n % i == 0:
sum += i
return sum
n=int(input())
dict={}
lst=[]
for a in range(1,n+1):
b = sumElem(a)
c = sumElem(b)
if (a == c and a != b) and not( a in dict):
dict[a]=1
dict[b]=1
lst.append([a,b])
print("%d %d"%(a,b))
print返回值是None你最后那个列表里面什么都没有,都是None,至于逻辑对不对,你打印检查一下吧
您好,我是有问必答小助手,您的问题已经有小伙伴帮您解答,感谢您对有问必答的支持与关注!