LPTHW - Exercise 2: Comments and Pound Characters
Another gentle intro/recap of the first lesson.
# A comment, this is so you can read your program later # Anything after the # is ignored by python. print("I could have code like this.") # and the comment after is ignored # You can also use a comment to 'disable' or comment out a piece of code: # print "This won't run." print("This will run.")
Learn Python The Hard Way Study Drills
1. Find out if you were right about what the # character does and make sure you know what it's called (octothorpe or pound character).
I was correct, it's 'comments out' code meaning it will be ignored by the interpreter. It's obviously called a hash sign too!
2. Take your ex2.py file and review each line going backward. Start at the last line, and check each word in reverse against what you should have typed.
3. Did you find more mistakes? Fix them.
4. Read what you typed above out loud, including saying each character by its name. Did you find more mistakes? Fix them.
As ever, source files on GitHub.