Python

Comments

An introduction to an important concept that is vital for efficient software development and teamwork

What are comments?

Comments are a part of all coding projects. They help you remember the purpose of certain parts of code but they don’t do any commands of their own. They serve as descriptions that help you or others better understand your code. In Python, single-line comments are written after the ‘#’ sign.

x = 15
x = x + 1     # Add 1 to x and store it in itself

print(x) 
# Print the value of x
# to the output console so the 
# user can see the value of x.

NOTE: It is very easy to forget to comment on code. But it is important to do so with more complex projects so you don’t waste time later on trying to understand what you wrote.

chevron_up