Comments

When creating a Python program, we can add some notes by adding one line comments using #. Comments are the parts of the code that do not effect the program. Anything after the # symbol is part of the comment and is ignored by your code. Comments are put in the code to tell the readers what the code is doing. They can make maintenance of code easy and can also help in finding bugs.

If at any time while writing code you wish to write notes to help you understand the code, use the # symbol to create a comment.

# This is my first line of code
print("Hello, World!")

Screenshot showing the comment This is my first line of code.

Be careful, if you remove the # symbol, your code will not work!

Screen shot of the code showing removal of the # before the comment causing an error in the code execution

Try adding a comment above your first line of code and press run. You will see that the computer will ignore your comment.