Python 3 Tutorial · Chapter 5 of 22
Python Comments
Explain code without changing program behavior.
Use # for a single-line comment.
Good comments explain why, not just what the code already shows.
Comments sample
Try it Yourself »
# Greet the student
print("Hello")
# End of program
Classroom Tips
- Do not leave old broken code commented forever.
- Comment the purpose of tricky logic.