In this tutorial we will learn how to create a single and multiline comment in python. single line comment in python uses symbol # and multi line comment in python uses three single quotes (”’) lets see an example of each.
Single line comment in python:
Comment explaining the code within single line is called single line comment. Single line comment in python should start with symbol #
Multiline (multiple line) comment in python:
Comment explaining the code more than one line is called multiline comment (multiple line comment). Multiline comment in python should be enclosed with in three single quotes (‘ ’ ’)
Example of Single line comment in python:
Python ignores the line that starts with symbol #
Output:
Hello
10
Example of Multiline comment in python:
Python Ignores the multiline comment that is enclosed with in three single quotes (‘ ’ ’)
Output:
Hello