Final answer:
Pre- and post-conditions for a function should be written before the function definition.
Step-by-step explanation:
The pre and post conditions for a function should be written before the function definition is written. Pre-conditions describe the state of the system that must be true before the function is executed, while post-conditions describe the expected state after the function execution.
For example, consider a function that calculates the average of an array. The pre-condition could be that the array must not be empty, and the post-condition could be that the average value is returned correctly. By specifying these conditions, we can ensure the function is used correctly and produces the expected results.