![]() ![]() |
Conceptual Review (page 48 of 55) |
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.
These steps will define the function. If we change the logic inside of the function, then we must re-execute the code starting with the "def" to the end of the function. Our modifications do not get changed until we re-execute our definition code. If we close the console or terminal window, we will also have to re-execute our definition code.