How do I format docstrings?
All of our functions should have Docstrings. Recall from class that Docstrings are special comments contained within triple quotes at the very beginning of a function that describe what the function does, its parameters and its return value (if any). We want to use standard format shown in class with a one sentence description of the function and explicit sections for the parameters and return value. For example:
def foo(x): """ Doubles input. Args: x: value to be doubled Returns: Doubled value """ return x * 2
If a function doesn’t have a return value (most of our functions in this lab do not), we don’t include a “Returns” section in the Docstring. For example:
def foo(x): """ Prints double the input. Args: x: value to be doubled """ print(x * 2)