Q.

What are Comments? Write the different ways of writing comments in Python.
What are Comments? Write the different ways of writing comments in Python.

Chapter-2 | ਪਾਇਥਨ ਪ੍ਰੋਗਰਾਮਿੰਗ ਸਬੰਧੀ ਮੂਲ ਧਾਰਨਾਵਾਂ | Basic Concepts of Python Programming

Comments are the integral part of a program. A comment in the program is a text that explains the code written in the program. The compiler and interpreter ignore these comments and do not execute them. They make the code easier to understand. There are mainly two ways to write comments in Python programs:
1) Single Line Comments: These comments are written in a single line. For Example:
# This is an example of a single comment

2) Multiline or Block Comments: These comments are written in more than one line. For Example:
“““This is a multiline
comment.”””


Comments are the integral part of a program. A comment in the program is a text that explains the code written in the program. The compiler and interpreter ignore these comments and do not execute them. They make the code easier to understand. There are mainly two ways to write comments in Python programs:
1) Single Line Comments: These comments are written in a single line. For Example:
# This is an example of a single comment

2) Multiline or Block Comments: These comments are written in more than one line. For Example:
“““This is a multiline
comment.”””