By: Zed A. Shaw Viewed: 193 times Printer Friendly Format
Comments are very important in your programs. They are used to tell you what something does in English, and they also are used to disable parts of your program if you need to remove them temporarily. Here’s how you use comments in Python:
1 # A comment, this is so you can read your program later.
2 # Anything after the # is ignored by python.
4 print "I could have code like this." # and the comment after is ignored
6 # You can also use a comment to "disable" or comment out a piece of code:
7 # print "This won't run."
9 print "This will run."
What You Should See
$ python ex2.py
I could have code like this.
This will run.
Most Viewed Articles (in python )
Latest Articles (in python)
Comment on this tutorial
- Cloud Computing
- Java Beans
- Mac OS X
- Office 365
- Tech Reviews