Video 8: Functions (page 4 of 9) |
4) After we optionally enter our parameters, we type a colon (:). This colon (:) is used to mark the end of the function header or function signature.
5) After our colon, we should document our function using a docstring comment to explain the purpose of the function. Documenting is obviously optional but it is certainly a best practice to describe the function's purpose!
6) Next, we have the body of the function, which contains one or more valid Python statements that make up the function body. Statements in our function must have the same base indentation level (usually 4 spaces).
7) Finally, we can optionally have a return statement if our function is a fruitful function that returns a value or a set of values.