Python入门求助!
def count2(a,s):if a>1:
s=a*s
a=a-1
count2(a,s)
return a,s
a=6
s=1
print(count2(a,s))
我就想用递归的思想,来计算6的阶乘,各位大佬们,怎么会失败啊 def count2(a):
if a > 1:
return a * count2(a - 1)
else:
return 1
print(count2(6)) 你的函数调用一直没有返回,有递没有归
def count2(a,s):
if a>1:
s=a*s
a=a-1
return count2(a,s)
else:
return a,s
a=6
s=1
print(count2(a,s))
页:
[1]