In this tutorial, we will learn about Comments in Python. Comments are not used to perform any function in the program but they really useful for developers. Developers can write comments with variables and functions to remember their working (purpose) in the program. One important thing to mention comments doesn’t put any impact on the execution of program because interpreter simply ignores them. There are two kinds of comments in Python:
Page Contents
- Single-Line Comments
- Multi-Line Comments
Single-Line Comments:
Single line comments are used to add one line comments with variable and functions. We id hash sign(#) to create a single-line comment in Python. Please check this example to understand it more wisely.
Example Program:
#This is sigle line comment
print("Welcome to Owlbuddy")
Multi-Line Comments:
The multi-line comments are used to write comments of more then one line in program. we have two options to add multi line comments in Python. First one is using hash sign(#) second one is triple quotes(”’).
Multi-Line Comments using #
#This is sigle line comment
#using hash sign
print("Welcome to Owlbuddy")
Multi-Line Comments using ”’
'''This is sigle line comment
#using hash sign'''
print("Welcome to Owlbuddy")
Here Triple Quote Comments are working because Python simply ignores all the string literal which are not assigned to any variable.
Parvesh Sandila is a results-driven tech professional with 8+ years of experience in web and mobile development, leadership, and emerging technologies.
After completing his Master’s in Computer Applications (MCA), he began his journey as a programming mentor, guiding 100+ students and helping them build strong foundations in coding. In 2019, he founded Owlbuddy.com, a platform dedicated to providing free, high-quality programming tutorials for aspiring developers.
He then transitioned into a full-time programmer, where his hands-on expertise and problem-solving skills led him to grow into a Team Lead and Technical Project Manager, successfully delivering scalable web and mobile solutions. Today, he works with advanced technologies such as AI systems, RAG architectures, and modern digital solutions, while also collaborating through a strategic partnership with Technobae (UK) to build next-generation products.
