Functional programming
1. Simplify the code,
2, easy to call and modify
3. Call parameters, formal parameters, and positional parameters. Key parameters, positional parameters can only be sent after the key parameters
##4. Default parameters
5. Parameter group (*args) Tuple parameters
6 Accept dictionary (**kwargs) When used simultaneously, it must be placed at the end of the parameter
The program runs Run from the above to the bottom of the file
# This local variable
A variable only takes effect in the function.
Global variables cannot be accessed from the outside
Variables declared at the top level of the file Global variables cannot be modified in the function, otherwise it will be difficult to debug
Recursive function
1. There must be a clear end condition
2. Each time you enter a deeper level of recursion, the problem size should be reduced compared to the last recursion
3. Recursion efficiency is not high, and too many recursion levels will cause stack overflow.
The above is the detailed content of Points to note when learning Python functions. For more information, please follow other related articles on the PHP Chinese website!
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn