Python learning notes --- form parameters (parameter) and actual parameters (argument), pythonargument
Def mydemo (name ):
'Name in the function definition process is called a form parameter'
# Because it is only a form that occupies a parameter location
Print ('passed in '+ name +' is called a real parameter because it is a specific parameter value! ')
Mydemo ('john ')
# John passed in the function call process is called a real parameter because it is a specific parameter value!
Mydemo (name = 'john ')
# When a function is called, if too many parameters are passed, the location of the parameters corresponding to the parameters is unclear. Therefore, when calling a function, you can assign values to the parameters directly.
The keyword parameter is the built-in parameter of the function.
The default parameter is to assign an initial value to the form parameter.
A collection parameter is a * parameter added before the parameter, which can also be called a variable parameter.
Def test (* arg)
Print ('parameter length: ', len (arg ))
Print ('second parameter: ', arg [1])
Test (, 'abc', 'de', 'China', 7)