Python: Comments

  • Comments are lines of text in your code that Python ignores.
  • Comments are for the human, not the machine.
  • For example, a comment can explain a section of code so another programmer can understand it.
  • A comment can help you figure out your code when you come back to it a month or a year later.

Types of Comments

  • Single Line Comments: A single line can be commented by using a # symbol
  • Paragraph/Multi-line Comments: A paragraph can be commented by using a triple quote

Syntax

#This is a single line comment
"""
This is a multiple line comment
written in
more than one line
"""