Page 73 -
P. 73
sharing your code
Comment your code
It’s always a good idea to include comments with your code. As your plan to
share your module with the world, well-written comments help to document
your work.
In Python, a common commenting technique is to use a triple quote for
multiple-line comments. When you use a triple quote without assigning it to a
variable, everything between the triple quotes is considered a comment:
Hello! I’m a big string who
just happens to be a Python
comment, too. Nice, eh?
Start with a
triple quote…
"""This is the standard way to
include a multiple-line comment in
your code."""
…and end with a
triple quote.
Here is your module code (which is saved in the file nester.py). In
the spaces provided, use your pencil to compose two comments: the
Put your module first to describe the module and the second to describe the function.
comment here.
def print_lol(the_list):
Add a comment
for your function
here. for each_item in the_list:
if isinstance(each_item, list)
print_lol(each_item)
else:
print(each_item)
you are here 4 37