㈠ python緇欎竴涓鏁版眰鎵鏈夊洜瀛愮殑鍜
def yz(a):
yz=[]
he=0
for i in range(a):
ii = i+1
if a%ii==0:
yz.append(ii)
for h in yz:
he+=h
return he
if __name__ == '__main__':
a = int(input('杈撳叆涓涓鏁存暟錛'))
print(yz(a))
㈡ python從鍵盤輸入一個整數值n,編程求它的所有因子之和,規定n不大於1000
n=int(input("pleaseinputaintegern:"))
result=0
foriinrange(1,n):
ifn%i==0:result+=i
print("thefactorofnsumis:%d"%result)