syntax and writing of functions:
function Syntax:
def functionname (parameter 1, parameter 2,......): function body (the function statement you want to implement)
Return[expression] #不带表达式的return相当于返回None
Function name Command rule:
Lowercase letters, dividing between words with _
Parameter rules:
1) without parameters, the function does not need to pass any parameters when it is run. 2) can take parameters or multiple parameters, write a few parameters, call the function, it is necessary to pass the number of parameters. 3) The parameter with default value is placed in front of the parameter without default value, otherwise it will be error.
return value:
1) can not return
2) with return, you can return a null value or return a specified value.
3) The return value can be used as the calling value of the next function, or as an alternative. But if you want to print the return value, save the return value in a variable and print it out.
python--function