Learnmonkey Learnmonkey Logo
× Warning:

The tutorial you are reading is currently a work in-progress.

Python Comments

What are Comments?

When we're coding, sometimes we want to just put type something without Python running it. Or maybe we have some code that doesn't work, but we still want to save it for reference. To do this, we use comments.

Single-Line Comments

To do single-line comments in Python, we simply put a number sign (#) in front of it. For example, run:

#print("Hello World")

Nothing is outputted.

Multi-Line Comments

To make a multiline comment (one spanning multiple lines), wrap the entire thing you want to comment out in three quotes (""" or '''). For example, run:

'''print("Hello")
print("World")'''

Again nothing is outputted.