Computer Science, asked by monikaarunsingh, 2 months ago

What are python comments give suitable examples of python comments

Answers

Answered by manoharlal2181
4

Answer:

Python Comments

In this Python program we are seeing three types of comments. Single line comment, multi-line comment and the comment that is starting in the same line after the code

Answered by pinnampaone25
3

Answer:

Comments can be used to explain Python code.

Comments can be used to make the code more readable.

Comments can be used to prevent execution when testing code.

Comments starts with a #, and Python will ignore them.

Example:

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

To add a multiline comment ,Since Python will ignore string literals that are not assigned to a variable, you can add a multiline string (triple quotes) in your code, and place your comment inside it:

Example

"""

This is a comment

written in

more than just one line

"""

print("Hello, World!")

Similar questions