>> Strings are a really useful data structure in Python,
especially when we're dealing with biological data sets.
DNA sequences are really nothing but strings of letters A, C, G and T.
Protein sequences are also strings of letters with a 20-letter
alphabet instead of a 4-letter alphabet.
So if you're doing Python programming for
biological sequence analysis you're going to use a lot of strings.
So a string in Python is just a series of letters surrounded by quotes.
You can just type in a single quote, 'atg', and another single quote, and
Python will interpret that for you and return the string 'atg'.
You can also use double quotes.
So we can do the same exact thing, we can type "atg", and
Python again will return the same string "atg".
However, we can make a longer phrase like this,
'This is a codon, isn't it?' we could type.
And put quotes around that.
If you did that to the Interpreter, you're going to get a strange thing,
you'll get an error message, invalid syntax, and you'll see there's a little,
tiny caret, a little up arrow thing under the letter t in isn't.
Well, what happened there was if you're reading it as English then you
would just type isn't it as you did and
maybe not thinking that the single quote that you're putting there is actually
matching the single quote used at the beginning of the line.
So single quotes have to come in pairs and double quotes have to come in pairs.
As soon as you put in this single quote after the letters I-S-N,
that finished off that first string and now you just type the letter t
without anything in front of it and Python doesn't like that.
So you can't do that.
So if you want to have something like a single quote inside of your string, then
you can do that, use double quotes, and then type your string as "This is a codon,
isn't it?" putting double quotes around it and Python will read along your string
until it gets to the second double quote before it closes things off.
So that's perfectly legal and Python will return the whole string for you.
Or on the other hand, and this is true not just for quotes but for
other special characters, you can use this backslash character as
an escape character, which mean it tells Python, look,
whatever is coming next, treat this as a character and don't try to interpret it.
So we could type that same string, This is a codon, isn\'t it?
In single quotes if we put a backslash in front of the first occurrence of
the single quote in the word isn't.