Comments
Python has comments
are used for the purpose of documentation.
comment lines will
not executed at runtime.
Comments are start
with a #, and Python will render the rest of the line as a comment:
Example
Comments
in Python:
#This is a comment.
print("Hello, World!, Welcome to Python!")
print("Hello, World!, Welcome to Python!")
Docstrings
Python also has
extended documentation called docstrings.
Docstrings can be one
line, or multiline.
Python uses triple
quotes as docstring:
Example
Docstrings
are also comments:
"""This is a
multiline docstring..........."""
print("Hello, World!, Welcome to Python!")
multiline docstring..........."""
print("Hello, World!, Welcome to Python!")
No comments:
Post a Comment