0% found this document useful (0 votes)
13 views1 page

Understanding Python Comments

Python supports two types of comments: single line comments that start with '#' and multi-line comments enclosed in triple quotes. An example of a single line comment is '# This is single line comment.' while a multi-line comment can be written as '''This is multiline comment'''. Both types of comments are useful for adding explanations or notes in the code.

Uploaded by

adi9910119238
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views1 page

Understanding Python Comments

Python supports two types of comments: single line comments that start with '#' and multi-line comments enclosed in triple quotes. An example of a single line comment is '# This is single line comment.' while a multi-line comment can be written as '''This is multiline comment'''. Both types of comments are useful for adding explanations or notes in the code.

Uploaded by

adi9910119238
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Python Comments

Python supports two types of comments:

1) Single lined comment:

In case user wants to specify a single line comment, then comment must start with ?#?

Eg:

1. # This is single line comment.

2) Multi lined Comment:

Multi lined comment can be given inside triple quotes.

eg:

1. ''''' This
2. Is
3. Multipline comment'''

eg:

1. #single line comment


2. print "Hello Python"
3. '''''This is
4. multiline comment'''

You might also like