Lesson 2. Code Comments

Like every single programming language I am aware of, Python has a way for you to comment your code by marking text in such a way that it hides the text from the interpreter.

Python, however, does not inherently have a way to make multi-line comments like other languages. Below I will teach you a way to work around that limitation.

Examples

Single Line Comment

Single line comments simply start with a hashtag.

In [ ]:
#This is a single line comment.

Multi-Line Comment

Multi-line comments can be created by wrapping your text in a set of triple quotation marks. As you will see, some IDEs like to automatically pair your quotes so creating just three can be something of a challenge.

In [ ]:
"""
This is a
multi-line comment.
"""

Copyright © 2020, Mass Street Analytics, LLC. All Rights Reserved.