我试过了:
def fibonnaci(n):
total_call = 0
if n ==0 or n == 1:
return 1
else:
if n== 2 or n == 1:
total_call +=0
else:
total_call +=2
return fibonnaci(n - 1) + fibonnaci(n - 2), total_call
n = 8
print(fibonnaci(n))
但我得到了一个错误:
TypeError: can only concatenate tuple (not "int") to tuple
如何显示斐波那契的通话次数?
慕丝7291255
千万里不及你
郎朗坤
相关分类