Is there a way to create multiline comments in Python

0 votes
Most languages have block comment symbols like

/*

*/

I tried this in Python, but it throws an error, so this probably is not the correct way. Does Python actually have a multiline comment feature?
Feb 7 in Python by Dev
• 6,000 points
23 views

1 answer to this question.

0 votes

In Python, you can use '''  some comments '''' or " " " some comments " " "  using triple quotes for multi-line comments.
# is used for single-line comments.

For Examples:

" " "
print('This is an example of multi-line comment')
print('This is how all the statements will be treated as comments')

" " "
a=10
b=20
sum = a + b
print('Result is:' sum)
#this is a single-line statement.
#this is another comment 

Thus, we can use # for single-line comments also for multiple comments.

answered Feb 7 by Nandini
• 5,480 points

Related Questions In Python

0 votes
1 answer

Is there a foreach function in python and is there a way to implement it if there isnt any

Every occurence of "foreach" I've seen (PHP, ...READ MORE

answered Aug 31, 2018 in Python by charlie_brown
• 7,710 points
408 views
0 votes
1 answer

Is there a way to list out in-built variables and functions of Python?

The in-built variables and functions are defined ...READ MORE

answered May 14, 2019 in Python by Junaid
733 views
0 votes
1 answer

Is there a way to loop between 0 and 1 by 0.1 in python?

You can use the linespace function. It ...READ MORE

answered May 28, 2019 in Python by Olly
1,240 views
0 votes
1 answer

Is there a way to store this text in a list using selenium (python)

Try using this code snippet to resolve ...READ MORE

answered Aug 24, 2020 in Python by Carlos
650 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 2,828 views
0 votes
1 answer
0 votes
1 answer

Is there a label/goto in Python?

Since Python is a structured programming language, ...READ MORE

answered Feb 4 in Python by Nandini
• 5,480 points
18 views
0 votes
1 answer

How can I add new keys to a dictionary in Python?

Yes, it is possible to add new ...READ MORE

answered Feb 9 in Python by Nandini
• 5,480 points
34 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP