A Python question [ solved ] | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 8

A Python question [ solved ]

Hi all, just wondering about python comments? I'm not very far through the Python course, but so far I haven't seen a lesson for Python comments, so would just like to know if there are Python comments or if they explain it later. I'm a beginner, BTW 😄 Thanks 😊🙂

19th Dec 2017, 5:35 AM
Learnsolo
4 Answers
+ 4
#One line comment """ Multiple line comment """
19th Dec 2017, 5:43 AM
Dima Makieiev
Dima Makieiev - avatar
+ 6
Thanks so much @Dima, is it in the course?
19th Dec 2017, 5:45 AM
Learnsolo
+ 3
Yep, module 3: Functions & Modules. Lesson comments and docstrings.
19th Dec 2017, 5:48 AM
Dima Makieiev
Dima Makieiev - avatar
+ 1
Proper comments are actually any string directly following a "#" (and before the newline). If it's not at the beginning of the line, any code preceding it is executed and the rest of the line is omitted. Between triple quotes are "docstrings" used for description (like with help()). According to Python developper guide : """ A docstring is a string literal that occurs as the first statement in a module, function, class, or method definition. Such a docstring becomes the __doc__ special attribute of that object. """
19th Dec 2017, 3:52 PM
Nonov Urbiznes
Nonov Urbiznes - avatar