 Hey, what's going on, guys? Rilinel here, coming back at you with some more Python tutorials. Let's get started. I'm going to open up Unity and get idle started. Drag it right on over so you guys can see it. And we'll create a new program here. Save this as file.python, like in USR bin environment Python. Get a class started. Make sure you have both underscores on either end. Now we can get started. So now today we're going to be checking out strings, like we have been in the last couple of tutorials. So let's create a new string. self.string can be equal to this is a string. This is a string, isn't it? It is, right? I suppose I don't even need that one here. It is, right? All right. So now we're going to take a look at the new function called, you would normally be able to work with it as a string, and then you would find the first occurrence of a substring, or you'd be looking for something inside this string. So if we checked out a string find, and then we were looking for is inside our self.string, it would go through and look for it. And then, hey, it found is right there on the index two, because we have zero, one for h. And then we have two right here. It starts that I, and then you have is. So let's give it a go. If we print it out, self.string.find, make sure we use our dot selector here, and then we can find is, we run this, we get two. Now find is a special function, because we can supply wherever we want to start looking. If we want to start looking at three, the index right after two, it'll find the next occurrence. In that case, five. So zero, one, two, three, and then it goes for five, because it found is right at that five position. So if we do after five, but if we did six, it'll find the next one over 21. And that's this is right here. And now we can supply an end to we can go from like six to 20. So it won't find this next one. And then we'll return negative one, because it didn't find it. Now there's a similar function to this called index. So we can start that up self.string.index. And the thing is, if we run this, and it doesn't find it, it'll return error. So we're going to be able to work with that later on, value error, because it doesn't find it. We're going to be able to work with like modifying these errors and being able to continue to code or at least continue to go through the program if we happen to come across one, and that sort of thing. But that's for a whole nother tutorial. So let's take a look at this print.find function, though. Let's see what we can do here. Let's try and create it on our own. Let's create a new function. I'm going to call mine find the self keyword, we need the string, we know what we're looking for, we need to know the start and we need to know the end. So it's a whole bunch of arguments here, but we're going to be able to make up for all of them. And remember, some of these were optional start and end were optional. So we can do a start equals zero. And end is going to equal none. So now if end is still equal to none, by the time we pass to it, we're going to want to make up for that. We want to know okay what the actual end of the string is. So end is going to equal the length of the string. And now we need to know how much we're looking for too. So look for length can be equal to the length of what we're looking for. Because we're going to be adding on to our index just like we've done in some other loops. So let's give it a go. We want to do for i in range. So we're going to be counting through these strings here, start and end. We got our code block started. And then we can test if the string at our current position is equal to the beginning of what we're looking for. Remember, we're going to want to index with zero. So we can get the beginning of that string. And if it is, then we can okay, we can start to test whether this is what we actually want to look for. If the string, and then we're going to slice here, we're going to go from i, the current position, and then i plus the look for length. And if that is equal to what we're looking for, so if it finds something that we're looking for at the current position, it can return the current position. And if it doesn't find any of these, though, we're just going to want to return negative one. Because just like how that find function did up there, it's just going to return what it didn't find. So let's try it. Let's try our new function. If we just do, if we just went with the regular one, though, it goes for negative one. So if we try it with that same arguments with our function, self dot find, we can pass in the string, can pass in is, because that's what we're looking for. We can go for the start, let's say six for now, let's do 20. And then we can keep a look at it. We get negative one and negative one. So let's set self dot start equal to two, self dot, let's see, and that can be 20 for now. But I don't think we'll use that. So let's pass in our self dot start variable. In our case, it will be two. So we'll get returned two and two because it finds it at that second position. If we switch to three, it'll find it again at five, because that's what we're looking for. And then if we tried it again right after that, say maybe six, we get 21 because it finds this one over here. So now if we do supply that self dot end variable, though, remember, we're going to have the same output as last time because it's not going to be able to find that next one because the end is limiting it. We have negative one because it can't go up until 21. It's only looking at this portion of the string. It ends right before that last is at the 21st position. So there you go, guys. There is the, here's the back end of the find function or at least one way that could possibly work. As always, as always, anyway, I recommend you use the built in function. But here is an example or one way you could get that same job done. But thank you for watching, guys. I hope you enjoyed this and I will see you in the next tutorial.