Easy Tutorial
❮ Python Fibonacci Sequence Python Errors Execptions ❯

Python3 Comments

In Python3, comments do not affect the execution of the program, but they make the code easier to read and understand.

There are single-line comments and multi-line comments in Python.

Single-line comments in Python start with #, for example:

# This is a comment
print("Hello, World!")

Multi-line comments use three single quotes ''' or three double quotes """ to enclose the comment.

1. Single Quotes (''')

#!/usr/bin/python3 
'''
This is a multi-line comment using three single quotes
This is a multi-line comment using three single quotes 
This is a multi-line comment using three single quotes
'''
print("Hello, World!")

2. Double Quotes (""")

#!/usr/bin/python3 
"""
This is a multi-line comment using three double quotes
This is a multi-line comment using three double quotes 
This is a multi-line comment using three double quotes
"""
print("Hello, World!")

Note: Multi-line comments can be nested, but single-line comments cannot be nested.

❮ Python Fibonacci Sequence Python Errors Execptions ❯