Python Comments

When a program gets bigger and more complicated it is more difficult to read the code. For this, it is a good idea to add comments to the programs to explain what is doing in the program. In python comments starts with a # character.

  1. # This is a comment of print Hello
  2. print('Hello!!')

You can also put the comment in the end of a line.

  1. print('Hello!!') # This is a comment of print Hello

Multi Line Comments

Actually Python does not provide any syntax for multi line comments. You have to use # in each line for using multi line comment.

  1. # This is a comment
    # for printing
    # Hello
  2. print('Hello!!')

you can also use triple quotes as a multiline string in your program. When you use triple quotes Python will read the code but ignore it as long as the string is not assigned to a variable.

  1. """ This is a comment
    for printing
    Hello """
  2. print('Hello!!')