[MUSIC] Strings are an important data type inside Python. Strings are basically just a sequence of characters and closing quotes. So here we have Hello, world is enclosed in quotes. Notice that in the case I'm using single quotes to enclose the string. I could use double quotes. It doesn't matter. You can use either one. So a string is just a sequence of characters and you know, it could be assigned to a variable just like anything. So you could say X equals hello world or something like that. And that would work. It can be manipulated so you can do things to it using string operators and functions. And we'll talk about some of the most common string operators and functions that you use to access certain parts of the string, things like this. So a small example. You can say hello. Just type in 'Hello, World' at the prompt, and it just prints it back to you. You could set variables equal to strings, so s = 'still' and t = 'life', and that's fine to do. Now, here are some string operators, some of the more common operators. Let's go through these one at a time. So let's take the first operator, x in s. Now in this case, x and s are both strings. And x in s tests if x is a substring of s. So it's a Boolean operator. It returns a true if x is, can be found within s, a bigger string s. X not in s is obviously the opposite, right? It returns true if x cannot be found as a substring within s. S + t is concatenation. So you take two, s and t are two strings, concatenation basically means putting the two strings together. So just gluing them together as one bigger string. So s + t returns a string, a new string which is the concatenation of the two individual strings. S x n and n x s, either importer doesn't matter. In this case s is a string and it's just some integer. And what that does is it concatenate s to itself n times. So if you say s times two, it takes s, whatever that string is, and repeats it twice. It concatenates it to itself two times. And then if you say s times three, it copies it three times and so on. All right now s[i], that's the index operation. And we'll talk about this, but basically that's how you access an individual character in a string. So if s is a string, then i is some integer, s of zero, s bracket zero, is the first character in that string. And then s bracket one is the second character in the string, and so on. So you can access individual characters inside a string using this index operator. And len, with s for s is a string, that just tells you the length of the string, you often need to know that in terms of the integer, which is the length. So these are very common operators, let's look at some of these operators in action. So here we have a just a, so we start off with Hello, World prints it out. S is equal to still, t is equal to life. And then after that we're using some Boolean operators. Actually, in addition to some string operators I described above, you can use Boolean operators, comparison operators. So for instance, s == 'still', all right, and s is equal to still, so that returns true. S not equal to t, that also returns true because s is still, t is life. They're not equal, so returns true. S less than t and greater than t. That's basically alphanumerical order, and since s is earlier, s is still and t is life, right? So life is earlier in the alphabet than still, so life is actually less than still by that ordering. So when you say is s less than t it's false and t less than s is true. So, let's go through some of those string operators. Remember, s is equal to still, t is equal to life in our example, so if I say s + t, it just makes a new string, stilllife, glues them both together, concatenates them together. Now, in the next line, I saw s +, and then in quotes I have a single blank space, so s + blank space + t, so I'm concatenating three things. Still, and then a blank space, and then t. So in the end I get, still life, as the new string. The last one I say 5 * x. I just take the word still, which is s, and repeat it five times and that's it, concatenate it five times. So those are some operators. Then here's another example of the concatenation. The multiple concatenations. So 20 * "_". I have an underscore in single quotes, so it just repeats 20 of them and gives me a big string of 20 underscores. Now the next one i in s is true. So it's looking at the string, a very short string, i, is that inside s? Now s is the word still, is i in there? Yes, there is an i in there, so it returns true. O in t. So o, the letter o is not in the word life, so o in t returns false. Li in t true because li is a substring of life, and length of t is 4 because life is 4 long. And there's the indexing operator. Indexing operator basically takes a string, in this case apple because apple is a string, and you could pass it inside the brackets, you pass an index number, an integer which is the value, the number of the character that you're looking for inside the string and it'll return that. So, s|0|, it starts at 0. It starts counting at 0. So, s |0| gives me the first character which is a capital A. S|1| gives me the second character which is lower case p. And so on. It takes the index as the argument and indices start at zero, remember that. That one off error, sometimes you think it starts at one. Remember in computer science we're always start at zero. And you can identify individual characters inside a string, or refer to them and use them in any way you want in the code. Thank you. [MUSIC]