How Does a Python Docstring Work?

Problem scenario
You know that Python has a feature for documentation strings that can print out when your program runs. How does it work as comments and as something that is displayed at the time the code is executed?

To best illustrate how one works, create a file called with this code and run it:

def cool_function(n):
    '''This is an example of a docstring.  You can explain the functionality of the function here.'''
    return "cool"


Leave a comment

Your email address will not be published. Required fields are marked *