Comments
A free lesson from Swipe Coding · Python, level 2 · updated October 2026
By the Swipe team, founded by Colin · how we make lessons
A comment is a note in your code that Python completely ignores when it runs. Comments exist purely for humans — to explain why a piece of code exists, or what a tricky line is actually doing — not for the interpreter.
# This calculates the discounted price price = 100 discounted = price * 0.8 # apply a 20% discount
Unlike Java's // and /* */, Python only has this one comment style. To comment out several lines in a row, you simply start each one with its own #.
# Step 1: read the input # Step 2: validate it # Step 3: process it value = input()
In Python, a comment starts with the ____ symbol and runs to the end of the line.
Good comments explain the why, not the what. print("Hi") # prints Hi is a useless comment — the code already says that clearly. A comment earns its place when it explains a reason that isn't obvious from the code itself, like why a particular number or approach was chosen.
What happens to a line of code that starts with #?
Python has a dedicated multi-line comment syntax, similar to /* */ in Java.
Your First Program
10 questions · pass with 60% — just like in the app.
What must a Python file contain to be a complete, runnable program?
In Python, the interpreter executes a file's statements from top to bottom.
Python files conventionally use lowercase, underscore-separated names, a style called ____.
Which function is used to display output in Python?
By default, print() places a single space between multiple comma-separated values.
The end keyword argument of print() defaults to a ____ character.
What symbol starts a comment in Python?
Python has a dedicated multi-line comment syntax, similar to /* */ in Java.
To comment out several lines in a row, you start ____ of them with its own #.
What does sep="-" do when passed to print("a", "b", "c", sep="-")?
Keep your streak going in Swipe Coding
Swipe through every level of Python on your iPhone — with XP, stars, streaks, a personal advisor and the full track beyond these free levels.
Get the Swipe apps →