Python Comments
# comments Practice

Comments — notes for humans, not the computer

Lines starting with # are ignored when Python runs. They explain intent — like sticky notes on a recipe.

Picture this: comments are sticky notes

Python skips anything after #. Humans still read it.

# why this codefor people
→
print(...)Python runs this
→
Screenonly the print

Comments do not appear in the output.

In easy words: What is a comment?

A comment is a note for humans in code. In Python, lines starting with # are ignored during execution.

Where comments are used

Used to explain tricky logic, document decisions, and help teammates understand code quickly without changing program behavior.

Real world: recipe margin notes

Chef writes "# use oat milk for vegan" on the recipe card. The customer still gets the dish; the note is for the cook. Python skips # lines but teammates (and future you) read them.

Toggle: show what Python executes

1# Greet the learner in Kodin Python track
2print("Kodin Python")
Only executable lines run →

Gray # lines = skipped  |  Highlighted line = runs

Good comment habits

  • Explain why, not what obvious code already shows.
  • Comments never replace clear variable names.
  • In practice you will print Kodin Python with a helpful comment above.

Example Program

1# Print a welcome message
2print("Kodin Python")