4 Antworten
+ 4
#One line comment
""" Multiple line comment """
+ 6
Thanks so much @Dima, is it in the course?
+ 3
Yep, module 3: Functions & Modules. Lesson comments and docstrings.
+ 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.
"""