Jamie Balfour

Welcome to my personal website.

Find out more about me, my personal projects, reviews, courses and much more here.

Part 2.2Comments in Python

Commenting is a very useful way of reminding future programmers or the original programmer when they haven't programmed on the same project for a long time what a section of code does. Therefore, it is recommend to comment code while working on it.

Most commercially developed applications have been commented because a wide array of people will work on them.

Commenting code in Python

There are two methods of commenting in Python. The first is the single line comment. This comment will take just that line of code out of the interpreted program. This is achieved using the # hash sign in Python:

Python
#This is a comment
    

The second option is the block comment (also known as a multi line comment). This will remove multiple lines of text from the interpreted program. This is achieved using the ''' syntax:

Python
'''This is a comment
This is also a comment
'''
    
Feedback 👍
Comments are sent via email to me.