1 - What is comment in Python
Programming languages provide a notation for inserting comments into the code, that is, text that will be ignored when the program is run. Comments can be used to explain a complicated part of a program, or to put indications in the code, like the source code, the language version...2 - Comment on a single line
In Python, we insert a comment on a single line with the character # (a pound sign).Syntax
#This is a comment that will be ignored at runtime
Example
# define a variable of the integer 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 comment on several lines in Python, we use the double quotes symbolSyntax
"""
This is a comment
in several lines
which will be ignored during execution
"""
Example
"""
Source Code: my-courses.net
date: September 2019
Author: Younes Derfoufi
"""
[my python code here]
my-courses.net
No comments:
Post a Comment