Exercises on Python Comments

The following exercises cover comments in Python.

Refer Python Comments.

Exercise 1

Specify the character that is used to define a single line comment.

This is a comment.

Exercise 2

To define a multiline comment in Python we use the same syntax as that of to define a multiline string. What is that? Triple quotes.


This is first line.
This is second line.

Exercise 3

Comment the following Python print statement.

print('Hello World')

Exercise 4

Comment the text after Python print statement.

print('Hello World')  This is a comment
Code copied to clipboard successfully 👍