Multi-line comments in Python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Multi-line comments in Python

So when i'm trying to write a multi-line comment on the first line, it look like a comment, it's grey you know. But when i'm trying to write a multi-line comment in the middle of the code it turns out green, why is this happening?

3rd Jan 2018, 6:02 AM
Tinatin Dalalishvili
Tinatin Dalalishvili - avatar
1 Answer
+ 2
Triple-quoted strings can also be string literals that extend across lines. They have two features (and a whole bunch of "subfeatures"), commenting (usually reserved for docstrings) and string literals. For example, this works: string = """I'm a triple-quoted string literal!""" but this doesn't: string = "I'm a single-quoted invalid string literal..."
3rd Jan 2018, 6:06 AM
LunarCoffee
LunarCoffee - avatar