求自定义函数推导过程?
def fx(x, y, z):if x == 1:
return x
else:
result = x + fx(x - 1, x + y, y- z)
print(result)
return result
fx(10, 0, 0)
出来的却是55,每次打印的结果是(3,6,10,15,21,28,36,45,55)
def fx(x, y, z):
if x == 1:
return y
else:
result = x + fx(x - 1, x + y, y- z)
print(result)
return result
fx(10, 0, 0)
改成 return y
出来的却是108,每次打印的结果是(56,59,63,68,74,81,89,98,108) rtiuyttr 发表于 2023-9-11 12:24
:(:Q:P
?
页:
[1]