Comments

Comments are used in Python to allow programmers to write notes in their code. These lines of code will not be run by the interpreter. There are 2 ways to do this in Python.

Single Line Comments (#)

In Python, you can use the "#" symbol to write comments that take up one line.

Example

#This is a comment
print("hello")

In the code sample above, it would only print the word "hello". The code snippet above would not print the words "This is a comment".

Multi-line Comments

In Python, you can use triple quotes to write comments that take up multiple lines.

Example

'''
This is a multi-lined comment. 
This uses single-quotes to make this comment.
These are called triple quotes because there are 3 quotes at the beginning and the end of the quote. 
'''

print("world")

"""
This is a multi-lined comment.
This uses double-quotes to make this comment. 
These are called triple quotes because there are 3 quotes at the beginning and the end of the quote. 
"""

In the code sample above, it would only print the word "world". The statement above would not print the explanation in the first and second comment.