Quotes and comments
Python accepts strings in single quotes ' as well as double quotes ". Both mean the same, as long as the string starts and ends with the same kind. That comes in handy when the text itself has quotes in it:
print('She said "hi" and left.')
print("It's a good day.")
She said "hi" and left.
It's a good day.The first string is in single quotes, so the double quotes inside it are just characters. The second is in double quotes, so the apostrophe in It's doesn't end it.
Comments
A line that starts with # is a comment. Python skips it completely: comments are notes for the people who read the code. A comment can also come after the code on a line; everything from the # to the end of that line is skipped:
# How many eggs the bakery needs this week
print("Eggs needed:")
print(12 * 6) # 12 cakes with 6 eggs each
Eggs needed:
72Programmers also use # to switch a line off for a moment without deleting it. This is called commenting out a line.