Home Tutorials Python Tutorial Comments
Comments

Comments


Definition: Comments are notes written inside code to explain what the program does.

Why: Beginner syllabi include comments very early because they help learners understand programs better and keep track of logic.

Syntax

# This is a comment

Example

# Store user name
name = "Anu"
print(name)

Key Notes

  • Comments are ignored by the Python interpreter and do not affect the output.
  • In Python, comments start with a hash character (#).
Example

🏋️ Test Yourself With Exercises

Take our quiz on Comments to test your knowledge.

Exercise »