不是求1-100的和?
# coding=utf-8
def sum(n,num):
if n==101:
return num
num=n+num
return sum(n+1,num)
num=0
num=sum(1,num)
print(num)
# coding=utf-8
def sum(n,num):
if n==101:
return num
num=n+num
return sum(n+1,num)
num=0
num=sum(1,num)
print(num)
2022-09-27
举报