In this lesson, you will learn to create strings with single and double quotes, use string methods to change capitalization, use string interrogation methods, and insert values into strings in real time using f-strings. Strings are a sequence representing text. Here's a string, it's represented by any unicode characters enwrapped in quotes. It can be single quotes or double quotes. Notice here that a string with single quotes and double quotes if their contents of the items within them are the same, they're considered equivalent. If we use the equals operator between them, you see that this is true, doesn't matter if you single or double quotes in terms of their equality. One of the values of this is it means that if you want to have quotes as part of the contents of a string, you just have to make sure to use the other type of quote to unwrap the string. Here we have double-quotes in this part of our string, and we've enwrapped the string with single quotes so that python knows what's content and what are the borders of the string. We can also do multiline strings by using triple quotes. This once again could be single or double quotes. Here we've a multiline string and if we print it, we see it prints as multiple lines. Now, there's some special characters that are interpreted differently in strings. For example, the \t is interpreted as a tab. We can see that there's a blank space inserted where that tab would be and the \n is a new line character. It puts the second half of the string or the second part of the string on a new line. Now, this can be a little tricky if you're doing strings that represent say windows paths or other strings where you want the backslashes to be backslashes. Here we have a path that has backslashes to represent directories, and we can see when we try to print it, those backslashes are interpreted as tabs and new lines and the whole string gets messed up. To avoid this, we can put an r in front of the string which makes it a raw string. In a raw string, all characters are interpreted purely as what they are. We can see here that our path is maintained if we keep it as a raw string. Let's make a new variable. The string that has two words in it, both capitalized. There's a lot of string methods that relate to capitalization. Some of the more commonly used ones will introduce here, one is capitalize, which capitalizes the first letter of a string, another is lower, which makes the whole string lowercase, and then there's upper which makes the whole string uppercase. Now, we've seen some sequence interrogation methods already and these work on strings. Here if we take a string and we use index on it, it will return the index of a substring. Now, we can use a substring that's more than one letter and you can see that it takes the index of that which starts at zero. It's important to know with the index method though, that if the item you're searching for does not exist in the string and you try to call index on it, it'll throw an error. There's a find method which is an alternative to index. The find method will not throw an error, it'll return negative 1 if the item is not in the string. Strings also have a startswith method, which is really useful for seeing whether a prefix is the prefix of the string and also an endswith method. Now, we can also look in more specialized fashion at the contents of a string. There's an isalpha method to say is it alphabetic, in this case it's not because it has numerals in it. There's also an isalpha numeric method isalnum, which says is it only alphabetic and numeric contents, for this case that's true. We can test whether a string is lower with the islower method or is upper case with the isupper method. Now, we can also test whether the contents for a string are numeric and this is useful if we want to try to turn that string into a number. This happens a lot with web forms where everything is entered as strings but some of the strings may represent values that you want to use as numbers. You can use isnumeric to see if a string represents the number before trying to turn it into a number. Now, format strings are a special string that we're introduced in Python 3.6. They're prefixed by either a upper or lowercase f, it doesn't matter which, and they allow you to insert values at runtime. This is a format string. It starts with the letter f, and it has in it, these curly brackets, which is known as a replacement field. Whatever the contents of a replacement field are, it can be any expression, will be inserted into this string. Here our expression is simply the integer 1, and we can see that 1 is inserted as part of the string. You can insert variables into replacement fields, so here we have two variables and we can see that both of these variables, the 5 and the 24, are inserted into the string at run-time. Now it can be any expression which means that we can do say, a math expression as part of our string, here we're using multiplication. We can also use indexing into a sequence as the expression in our replacement field. Here we have one list named players, and we're indexing into different parts of that list in our f string. Notice that the indexing doesn't have to be in any particular order. We're indexing index 1 and then index 0, and then index 2, and that's the order that they're items from the original sequence are inserted into our string. Now replacement fields allow you to do some formatting of the item inserted, the formatting generally happens after a colon. Here, we've got a variable set to a number, and we're inserting the number twice into this f string. The second time, we're using a colon followed by a 5d. Now what this does is it pads the item being inserted with whitespaces, and so that you can see that there's whitespaces placed in front of it to make it fit to 5. Now, this padding number can be inserted at run-time as well, so here the padding is a variable. The way we do this is by a nested replacement field, so we've got the outer replacement field, much as we had before, but inside of that replacement field, instead of having the number 5 explicitly written, we have a second replacement field with the variable that contains the value we want to pad. Now, a common formatting that we like to do is with numbers, so if we have a number like this, which is very hard to read on its own, if after our colon in our replacement field we put a comma, we can see that it inserts it with commas at the appropriate places. Now, strings have lots of built-in methods for handling whitespace and here we have a string that has blank spaces at the beginning and end of the string. This happens once again, a lot with user inputted text from web forms and this type of thing. Strings have a strip method, when we call that, any whitespace that's leading or trailing is removed and a new string is returned without those whitespaces. There's also a left strip and right strip method, which remove the whitespace from the appropriate end of the string, and this is another common string type you'll see inserted, that is a string which represents a sequence separated by commas. This happens a lot, once again in forms. Sometimes you'll get a string that represents a sequence. This happens is once again, a lot of times in forms or sometimes in spreadsheets, so here we have a sequence of words separated by commas, but they're encased in a string, so they're a single string. Now strings have a handy split method where we specify what the token is that we're splitting on, in this case a comma, and it returns a list of sub-strings split on that comma. Now, we can take a list of strings and join them together by using the join method. The join method takes a string, and as an argument, takes some kind of sequence, it then puts that sequence together with the initial string as a token in between and returns a single string. We can use our split method to split on the new line character of a string that contains such, but there's a specialized method called split lines because this case comes up so often, so split lines will split on newline characters and give you a list of sub-strings. In this lesson, you've learned to create strings with single and double quotes. To use string methods to change capitalization and string interrogation methods to understand the contents of a string. You've also learned to insert values at real-time using f strings, now you should try practicing with strings to get a better understanding.