Turning Learners Into Developers
Codekilla
CODEKILLA
back to course
Lesson 05 / 1144%· free preview
Getting Started5/5

Python Comments

How to write notes Python ignores.

Definition

Comments in Python — how to write notes python ignores. Understanding how comments works is essential for writing clean, idiomatic Python and is a stepping-stone to more advanced topics in the standard library and ecosystem.

How Comments Works in Python

Python implements comments with deliberate simplicity — the syntax is minimal and the runtime behaviour is predictable. Read the example below from top to bottom; Python executes each statement in that order, and the data flows line by line.

Code Example
python
# This is a single-line comment
'''
Multi-line
comment
'''
print('done')
Output
# Run the example in the Codekilla compiler to see the output
Explanation

This is the canonical minimal example for comments. Each line maps to one concept — change a value, re-run, and watch which output shifts. That experimentation loop is how all professional Python is learned.

Key Takeaways
  • Comments keeps Python code expressive and short.
  • Python's syntax was designed for readability — read code top-to-bottom like a recipe.
  • Built-in comments operations are written in optimised C inside CPython.
  • Combine this with previous lessons to build something useful.
Interview Questions

Practice Questions
  1. Re-type the Code Example from memory; run it.
  2. Modify one value and predict the new output before pressing Run.
  3. Combine this lesson with the previous one — write a 5-line snippet that uses both.
Pro Tips
  • Read the official Python docs for this topic at https://docs.python.org/3/ — it's the authoritative reference.
  • When stuck, drop a print(...) line right above the puzzling code — Python's debugger of last resort.
  • Use the Codekilla compiler to experiment without leaving the lesson page.
AI-powered recap

Quick recap quiz?

We'll generate 5 MCQs from this lesson and check your understanding instantly. Takes ~30 seconds.

Ready to move on?
// example library
Want more hands-on snippets in Python?
Browse 3 runnable examples · across 1 chapter · short, copy-paste-friendly · grouped by topic
Explore examples
// sharpen your skills
Put this into practice right now
LeetCode-style problems, graded difficulty, hints and expected outputs — learning beats passively reading every time.
Start Practicing
// feedback.matters()
Did this lesson help you?