标签:递归算法 python and else TE == pre 输入 style
#递归算法求和1-100
def qiehe():
def he(lis):
if lis == []:
return 0
return lis[0] + he(lis[1:len(lis)])
s = []
n = input("请输入数字:")
for i in range(1, int(n)):
s.append(i)
print(he(s))
qiehe()
def sum(max): if max <= 100 and max >= 0: return max +sum(int(max) - 1) else: return 0 print(sum(100))
标签:递归算法 python and else TE == pre 输入 style
原文地址:https://www.cnblogs.com/shishandeda/p/9248700.html