Comments in Python start with the hash character, #, and extend to the end of the physical line. A comment may appear at the start of a line or following whitespace or code, but not within a string literal. A hash character within a string literal is just a hash character. Since comments are to clarify code and are not interpreted by Python, they may be omitted when typing in examples. See an example below:
# first comment
Spam = 10 # Second comment
# Third comment
Text = “# This is not a comment because it is inside quotes. “