The following exercises cover comments in Python.
Refer Python Comments.
Exercise 1 – Single line comment
Specify the character that is used to define a single line comment.
This is a comment.
Submit Answer
↻ Reset
Show Answer
Fill the fields with missing code.
Exercise 2 – Multi-line comment
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.
Submit Answer
↻ Reset
Show Answer
Fill the fields with missing code.
Exercise 3 – Comment the code
Comment the following Python print statement.
print('Hello World')
Submit Answer
↻ Reset
Show Answer
Fill the fields with missing code.
Exercise 4 – Comment in the same line as code
Comment the text after Python print statement.
print('Hello World') This is a comment
Submit Answer
↻ Reset
Show Answer
Fill the fields with missing code.