1. There must be a clear end condition.
2. Each time a deeper level of recursion is reached, the problem size should be reduced compared to the previous recursion
3. Recursive efficiency is not high, too many recursion levels will cause stack overflow
(In a computer, a function call is implemented through a data structure such as a stack stack, and whenever a function call is entered,
Stack will add a stack frame, whenever the function returns, the station will be reduced a stack of frames, because the size of the stack is not infinite, so,
Too many recursive calls can cause the stack to overflow. )
Local variables and all variables
Scope of local variables:
Scope of all variables:
Global variables are not modified in a subroutine unless the global variable is a string or a number
When the global variable is a different complex type, if all variables are modified in the subroutine, the global variable is all modified.
"Python"-recursion, local variables and global variables