Python Comments & Documentation
Code tells the computer HOW to do something. Comments tell humans WHY you did it. Any text on a line following a hash symbol (#) is a comment, and Python will ignore it completely when executing your code.
"Comments are like sticky notes on your monitor or notes in the margin of a book. They help future you remember what you were thinking at 2 AM."
Deep Dive: How It Works
Single-line comments start with the hash character (#). Everything from that # to the end of the line is skipped by the Python interpreter.
You can also write inline comments on the same line as code: price = 100 # base price before tax.
Multi-line notes or docstrings use triple quotes (""" or '''). While technically multi-line string literals, when unassigned they serve as clean multi-line documentation.
Syntax Blueprint
# Single line comment x = 10 # Inline comment """ Multi-line explanation """
Use # for quick notes and triple quotes for multi-line documentation.
Core Rules to Remember



Common Beginner Traps & How to Fix Them
Over-commenting the obviousWhy it happens: Writing x = 1 # sets x to 1 adds visual noise without helpful context.
How to fix: Comment on intent, business rules, or tricky edge cases.
Live Interactive Example
Hit Run Code to see it liveYour Turn: Micro Challenge
No pressure! Edit the starter code below and test your solution with instant feedback.
Add a helpful comment and print output
Add a comment describing your code on line 1 starting with #.
On line 2, print "System check passed".
Finished reading and practicing?
Mark this lesson as completed to update your course progress.