First, the function definition:
A function is to encapsulate a set of statements by a name (function name), and to execute the function, simply call the name of its functions. "Methods in the same Java"
Second, define the function
The definition function uses the DEF keyword, followed by the function name, and the function name cannot be duplicated
Three, the function to pass the parameter attention point
1. * * parameters, pass the dictionary "non-mandatory"
2. *args can be used to customize the parameters, or do not pass the parameter
2. * * parameters, you can also pass the key parameter "non-required"
3. Note the order of the parameters: positional, default, variable, keyword "include dictionary"
Third, function return value attention point
1. Return type
A return value can return 0 or 1 or more
Directly returns only Ture or False is a Boolean type
Generally returns multiple is generally a tuple, which can be learned by printing the type
2. The positioning of the return value can be obtained by subscript, as
Python function Learning points