Programs can be quite complicated and are often thousands of lines long. It can be helpful to write a comment describing parts of the code so that when you or someone else reads it, the meaning is clear.
In Python, any time the # character is encountered, Python will ignore the rest of the line. Comments allow you to write English sentences (or, for that matter, sentences in any language):
| | >>> # Python ignores this sentence because of the # symbol. |
The # symbol does not have to be the first character on the line; it can appear at the end of a statement:
| | >>> (212 - 32) * 5 / 9 # Convert 212 degrees Fahrenheit to Celsius. |
| | 100.0 |
Notice that the comment doesn’t describe how Python works. It is meant for humans reading the code to help them understand why the code exists.