Python Comments

Comments are notes about the code that can explain the code to you or your fellow developers.

Comments are extremely important for you and for other people who will use your code. It is a good idea to get used to comment your code as soon as possible. When you will be working on someone else’s code, or even your own code after a long time, comments will save your life.

Single line comments

Python will ignore comments. In Python you can use hash mark (#) syntax for single line comments

Multi-line comments

Python doesn’t have multi-line comments so to write a multiline comment in Python we just need to place a hash before each line.

One easy way to use multiline comment could be to place a message inside a triple quotes (“””) block. However, Python will treat it as we a string literal rather than a comment. Python ignore string literal messages (explained in another topic).