1. function is a programming method of logical structure and process
The function definition in Python uses the keyword def to define
def test (x):
"The function Definitions"
X+=1
return x
def: A keyword that defines a function
Test: Function Name
(): parameter can be defined within
X+=1: code block or program processing logic
Return: Define the return value
2, the function of the characteristics:
1. Reusability of code
2. Maintain consistency
3. Scalability
3. Functions and Procedures:
Procedure definition: A procedure is simply a function with no return value
The Python parser implicitly returns none when a function or procedure does not use return display to define the return value, so in Python
Even a process can be counted as a function.
4. Parameter group:
def test (*args):
*args: Represents a parameter group
When calling in a function, passing arguments can be 1 or more
Test (1,2,3,4,5,6)
Test (*[1,2,3,4,5])
This way: *args: Accept n Positional parameters, convert narimoto Group form
def test (**kvargs):
Test (name= "Zhangsan", age= "20")
This way: **kwargs: Accept n keyword arguments and convert them into dictionaries in a way that
Python function programming