?为什么不对
def my_sumA(a): if a+1<=100: sum=a+my_sumA(a+1) else: sum=0 return sum print(my_sumA(1)) def my_sumB(n): sum = 0 if n == 1: sum = n else: sum = n + my_sumB(n - 1) return sum print(my_sumB(100))
def my_sumA(a): if a+1<=100: sum=a+my_sumA(a+1) else: sum=0 return sum print(my_sumA(1)) def my_sumB(n): sum = 0 if n == 1: sum = n else: sum = n + my_sumB(n - 1) return sum print(my_sumB(100))
2024-09-07
举报