This forum is now read-only. Please use our new forums at discuss.codecademy.com.
Multiline comments don't actually exist in Python
As part of the Python course it is taught that in order to do a multiline comment one should use
"""triple quotes""". This is wrong. Python only has one way of doing comments and that is using
Triple quotes are treated as regular strings with the exception that they can span multiple lines. By regular strings I mean that if they are not assigned to a variable they will be immediately garbage collected as soon as that code executes. hence are not ignored by the interpreter in the same way that
#a comment is.
The only exception to the garbage collection fact is when they are placed immediately after a function or class definition or on top of a module, in which case they are called docstrings and made available via the special variable
Due to the existance of docstrings I've seen a lot of people confused about the use of
I suggest that the multiline comment lesson is removed or replaced with the instructions from the official PEP8 - Block comments section.
Disappointingly the course has NOT been fixed and STILL, ONE YEAR LATER from the original comment above, teaches incorrect commenting. I also noted a module where the lesson showed comments using slashes "//". Strange AND misleading!
They really need to update their backend testing system to use the latest builds so that NEW LEARNERS, who are likely using the latest build, will get consistent results and correct instruction.
So, although I am glad this is free to end-users, the quality should be improved - definitely after a YEAR.
He understood that """triple quotes""" were used to include documentation within the code
def x_intercept (m, b): "" " Return the x intercept of the line y = m * x + b. The x intercept of a line is the point at Which it crosses the x axis (y = 0). "" " return-b / m