1. Common sense
When making a statistical table, it is necessary to create a listname_list to store the list, so that it is more convenient to update the list and delete it later.
Second, the first understanding of the function
The code skips when it encounters def, puts the function content in memory, and executes the function content when it encounters the function name.
1.return:
There is only one return, return None
return multiple values return a tuple
2. Parameters
def abs(x) x is a formal parameter
abs(y) y is the actual parameter
Parameter order: a positional parameter → b=1 default parameter → *args variable parameter → * city, job named keyword parameter → **kw keyword parameter:
One thing to keep in mind when defining default parameters: default parameters must point to immutable objects!
Variable parameters: Inside the function, variable parameters are automatically assembled into a tuple
Keyword arguments: keyword arguments are automatically assembled into a dict inside the function
3. Ternary operation
.............x if x > y else y