When writing code in Python, it’s important to make sure that your code can be easily understood by others.
Comment is a good idea to add notes to your programs to explain in natural language what the program is meant. These notes are called comments, and they start with the # symbol:
Therefore, Comments can be used to explain, make the code more readable and prevent execution when testing code.
#This is a comment. print("Hello, World!")
Hello, World!
We can also place comments'#' at the end of a line, and Python will ignore the rest of the line:
print("Hello, World!") #This is a comment.
Hello, World!
To have a multi-line comment in Python, we use triple single quotes at the beginning and at the end of the comment, as shown below.
''' This is a multi-line comment ''' print("Hello, world!")
print("Hello, world!")
''' We are writing a simple program here First print statement. This is a multiple line comment. ''' print("Hello World") # Second print statement print("Welcome to aimtocode?") print("Enjoy Learning Python") # Third print statement
Hello World Welcome to aimtocode? Enjoy Learning Python