In this tutorial we will learn about the python comments and we will also know about types of comments in the python.
What are Comments?
Comments play a very important role in the maintenance of the program. It explicates what’s actually happening inside a program. when we place comments inside the source code, it enhances the readability and understanding of the code.
Comments do not affect the execution speed and the size of the compiled program. Python Interpreter ignores the comment.
Python permits two types of comments, namely
- Single-line Comments
- Multi-line Comments
It begins with a hash (#) symbol and terminates at the end of the line.
If we want to put comments in more then one line we can use hash(#) beginning of every line.
There is one more way to do the same, using triple quotes either ‘’’ or “””