Comments are used to write something which the programmer does not want to execute. Comments can be written to mark author name, date when the program is written, adding notes for your future self, etc.
- Comments are used to make the code more understandable for the programmer.
- The Interpreter does not execute comments.
There are two types of comments in Python Language -:
- Single Line Comment
- Multi-Line Comment
Single Line Comment: Single Line comments are the comments which are written in a single line, i.e., they occupy the space of a single line.
- We use # (hash/pound to write single-line comments).
- E.g., the below program depicts the usage of comments.
Multi-Line Comment: Multi-Line comments are the comments which are created by using multiple lines, i.e., they occupy more than one line in a program.
- We use ' ' '….. Comment ….' ' ' for writing multi-line comments in Python (Use lines enclosed with three quotes for writing multi-line comments). An example of a multi-line comment is shown below:
Comments
Post a Comment