Function: A functional, reusable statement group definition function: def < function name > (< parameter (0 or more) >): < function body > return < return value > function definition The parameter specified is a placeholder and can be omitted When defining a function, you can specify a default value for some parameters, which form an optional parameter def < function name > (< optional parameter, < optional parameter >): < function body > return < return value ># You can design a variable number of parameters when defining a function, with no certainty as to the total number of parameters def < function name > (< parameters;, *b): < function body > return < return value > function call Parameters can be passed the return reserved word by location or name: The function can have a return value, or no-return can pass 0 or any number of return value local variables: A placeholder inside the function, and after the function operation is finished, the local variable is freed- Global reserved words can be used inside a function to work with globals and can be modified-local variables are combined data types and not created inside functions, equivalent to global variable lambda functions: Used to define a simple, function that can be represented within a line < functions name > = Lambda < parameters: < expression > Equivalent def < function name > (< parameter >): < function body > return < return value >
python-Syntax Basics (9) function