python
Add comments in python
In this post, we are going to describe how to add one and multiple line comments in Python.
#Write comment text here
print("Hello World 1!")
print("Hello World 2!") #OR like this
"""
This is a multiline comment
You can add as much lines as you want
"""
print("Hello World 3!")
Output
Hello World 1!
Hello World 2!
Hello World 3!
Hello World 2!
Hello World 3!
There are two ways to add comments in python. Either you can add '#' before any string or sentence or you can use """ comment text """ string literals. Python code will ignore the text written between them.
Was this helpful?
Similar Posts
- Add two list items with their respective index in python
- Add delay in code execution python
- Add items to dictionary in python
- Add items to list in Python
- Add item at a specific position in a Python List
- Python Strings: Learn How to Add Line Breaks
- Add column to existing table with default value SQLAlchemy