How to make multiline comments, and autocompletion of quotes

How can write multi line comments?
Is that I should use # at start of every line like,
#hey your are doing good
#kick start your progress”

7 Likes

Hey @methodwhiz28097
Multi line comments are written like this:

""" 
Several
Lines
"""

Hope that helps!

14 Likes

Thanks @stevencopeland
But could not type triple quotes in the coding area. When pasted yours it worked.

woah that’s weird. Can you send me the link to the exercise?

Sure…
comments exercise

Its either two quotes or 6 quotes are entering…

3 Likes

Snap, I’m not a pro user. Idk what the problem is…

Anyways thanks for quick response @stevencopeland :grinning:

2 Likes

np sorry I couldn’t help more

1 Like

Quotes (single or double) are handled by the editor just like parentheses: When you type in one single or double quote, the editor types in the second, and places the cursor between them so that you can begin typing your quoted material. If you type three, the editor assumes that you intend to triple-quote, and so puts in all six, again with the cursor in the middle.

8 Likes

I see, so in ide or editors they auto-completes. Thanks @patrickd314

1 Like

Kind of disagree, triple is string literal, So in essence a no opt execution context. Null, Nill, Notta, Nuttin.
Cheers

https://www.codecademy.com/forum_questions/505ba3cfc6addb000200e33c

1 Like

#this is so fun once you get the hang of it and know what your doing u will have alot of fun

hi there - how does Python distinguish between code and comment? I guess what I am really asking is how many characters can you have after the # before it starts interpreting as code again? Thanks!

1 Like

You probably have used space between triple quotes. I tried and failed as well. But when I omitted the blank spaces it worked!

1 Like

Great question - I was wondering the same thing. Is it just when you start a new line, do you need a space between??

Hi @retorik80, and welcome to the Codecademy Forums!

A comment begins with a # character that is not contained within a string, and continues to the end of the line. A space is not required within a comment, or to terminate a comment.

Triple quoted text does not constitute a comment. It is a string. For convenience, some programmers use it as if it were a comment, since it can span multiple lines.

2 Likes

Thanks appylpye!

That makes it clear - a comment ends when you start a new numbered line. If i’ve got alot of instructions i’ll have to use the triple quotes!

But if you use triple quotes to comment, it will revers other tripel quotes used in code e.g. to print sth in multiple lines. Is there any other method to make multiple line commentary?

Code and comment are basically the same thing, if I’m not wrong. however, comment is different in the context of execution- ignore part of the code and run the rest. hope this helps?