1. What is a Python comment?
Programming languages provide a method for inserting comments within code to provide additional informations. A comment is just a text that will be ignored when running the program. Comments can be used to explain a complicated part of a program, or to put indications in the code, such as the source code, the version of the language or script...
2. Single line comment
In Python, we insert a single-line comment with the character '#' (a pound sign).
# This is a comment that will be ignored when the code is executed
# define a variable of int type n = 5 # Display of the variable print ("The value of n is : ", n)
3. Comment on several lines
If we want to insert a multi-line comment in Python, we use the double quotes symbol """ ... """
""" This is a comment in several lines which will be ignored when running """
""" Source code: my-courses.net date: September 2022 Author: Younes Derfoufi """ [my python code here]