You should document your functions using a string at the beginning. This string is called a docstring:
def newton(f, x0): """ Newton's method for computing a zero of a function on input: f (function) given function f(x) x0 (float) initial guess on return: y (float) the approximated zero of f """ ...
When calling help(newton), you get this docstring displayed together with the call of this function:
Help on function newton in module __main__: newton(f, x0) Newton's method for computing a zero of a function on input: f (function) given function f(x) x0 (float) initial guess on return: y (float) the approximated zero of f
The docstring is internally saved as an attribute, __doc__, of the given function. In the example, it is newton.__doc__. The minimal information you should provide in a docstring is the purpose of the function and the description of...