DEV Community

Cover image for Python Day Three : Focus & consistency
Amina
Amina

Posted on

Python Day Three : Focus & consistency

Day Three lesson : Comments in Python

Comments are notes written in code to explain what the code does. Python ignores comments when running the program.
Example:

#This is a comment
print("Hello, Pure Pearl Foundation") 
Enter fullscreen mode Exit fullscreen mode
print("Hello, Pure Pearl Foundation") #This is also a comment
Enter fullscreen mode Exit fullscreen mode

Explanation:

  • This is a comment → A comment on its own line.
  • This is also a comment → A comment at the end of a line of code.
  • Python runs the print() statements but ignores the comments. output:
Hello, Pure Pearl Foundation
Hello, Pure Pearl Foundation
Enter fullscreen mode Exit fullscreen mode

Comments help make code easier to understand, explain code to others, and can be used to temporarily disable code during testing.

Good programmers don't just write code they write clear code. Using comments helps you stay organized and makes your programs easier to understand in the future. Keep practicing! 💻🐍

Top comments (0)