python function definitions and calls

A, python function classification:

1. 2. The built-in function to third standard library function 3. Function 4. User-defined functions

Function definitions and calls

Function must be defined before using the function execution def, creates a function object bound to the function and variable names, function definition syntax is as follows:

def function name (parameter list):
    // function from zero to a plurality of pieces of executable statements
    [return [Return value]]

Example:

Second, the return value:

return Return Value Points:

1. If the function body comprises a return statement, the function execution ends and returns a value;

2. If the function body comprises a return statement, then the value returned None

3. To return to a plurality of return value, use the list, tuples, dictionaries, a plurality of set values ​​saved.

Guess you like

Origin www.cnblogs.com/yingxiongguixing/p/12176113.html