The syntax for a single-line comment in Python is `#`. When Python encounters a hash character outside a string literal, it treats the character and the text following it as a comment until the end of that physical line.
A comment can occupy a complete line, as in `# calculate the total`, or follow executable code, as in `total += price # add the price`. Comments are ignored during execution, making them useful for explanations, reminders, and notes about non-obvious decisions. Python’s emphasis on readable code makes concise comments part of common style practice.
Python does not use `//`, `/* ... */`, or `<!-- ... -->` for ordinary comments; those forms belong to languages such as C-like languages or HTML. Triple-quoted text is sometimes used to span several lines, but it is technically a string literal, not a true block-comment syntax. When placed first in a module, class, or function, such a string becomes a docstring and can be accessed by documentation tools and the `__doc__` attribute.