Recursion function in Python

后端 未结 10 2176
庸人自扰
庸人自扰 2020-12-15 11:52

Consider this basic recursion in Python:

def fibonacci(number):
    if number == 0: return 0
    elif number == 1:
        return 1
    else:
        return          


        
10条回答
  •  一个人的身影
    2020-12-15 12:40

    In the expression fibonacci(number-1) + fibonacci(number-2) the first function call will have to complete before the second function call is invoked.

    So, the whole recursion stack for the first call has to be complete before the second call is started.

提交回复
热议问题