谢谢大佬,我是在https://github.com/jackfrued/Python-100-Days/这里学的,刚学到第五天
刚刚自己研究了下现在已经可以运行了,但是效率好像很低,要算很久
count = int(input())
for i in range(count):
is_perfect = 0
for j in range(1, i // 2 + 1):
if i % j == 0:
is_perfect += j
if is_perfect != 0 and is_perfect == i:
print('%d ' % is_perfect, end='')
我这就去看你给的素材