In computer programming, a string is a series of characters that include any letters, numbers, or characters. In Python, anything inside quotation marks (single or double) is a string. For example:
Personally, I prefer double quotation marks because single quotation marks can cause problems when you need to use an apostrophe.
If I was to print the same text using single quotation marks, I would receive an error message:
The error above can be fixed using a backslash in front of the apostrophe, but it is easy to avoid it using double quotation marks.
We can also use the backslash to print out quotation marks. For example:
If we want our text to be formatted exactly how we input it, we can use triple-quotation marks, similar to a docstring: