17 Aug Python Comments
Python Comments are used to provide extra details about various aspects of a program. They are usually included at the start of a program to indicate its purpose, its author, and the date on which it was written. They also provide clarification about complicated statements in the program.
Python Single-line Comments
The # (hash) is used in Python for single-line comments.
Python Multi-line Comments
The # (hash) can be used in Python for multiline comments. The triple-quoted strings can also be used for multiline comments.
Example
In this example, single and multi-line comments are covered in Python:
Demo14.py
# Understanding Python Variables
# Code by studyopedia
'''
Variables in Python are reserved
memory locations
'''
# Create a variable
# We are creating a variable with integer value
val = 6;
# Printing the variable value
print("Value = ",val) # displaying the value
If you liked the tutorial, spread the word and share the link and our website, Studyopedia, with others.
For Videos, Join Our YouTube Channel: Join Now
Read More:
No Comments