 Hey, what's up guys, RudeLinL here bringing you back with another Python tutorial and in the last video we were checking out getting the length of a data type, whether it be a string, like a tuple, a list, even an integer, we added support for that because we were taking a look at the length function or the LEN that built in Python length function and we tried to recreate it in our own work. So today we're going to do that exact same thing except we're going to work with it on a more deeper level. We're going to try and take a look at the length of multiple data types. So let's get it all filed up, fired up, first of all, and we'll try things out. Idle, come on kiddo. All right, now let's create a new program. I'm going to save mine as a filed up Python as usual. Get my shebang line going around here and now let's define a class. We can do base as usual, get a constructor coming. Remember to pass in your self keyword. Don't ever forget that when you're creating functions inside of a class. Now we can test if this is the current script we are running, if name is equal to main, and then if it is, we can go ahead and create a root object that is going to be an instance of the base class. And now let's just print hello world and get a couple new lines. So we run this, we get hello world and it looks like our object is created. So let's get started. We're going to try again by creating our new getLength function and we're going to pass in self as always. And usually we would just have an argument for the thing that we were getting the length of. Now today we're going to be looking at multiple things. So we're going to change this to items and we're going to put our asterisk in front of it. So this way we can pass in each argument and parameter and it's going to interpret them as a list or a tuple. So let's get our code block started and we can begin. Now last time we set up a length variable that we would iterate or at least increment every time we found something new. So this time we're going to use an all length, all lengths anyway, make that plural, that's going to become our array or our list. So now this time we're going to loop through everything that we found obviously. So we're going to go through four items in items. So we're looking through each thing that we've been passed. And now we can loop through it once again. We can check out four character in that item. And then we can set a length to plus equals one. And this is that same sort of tactic we were using earlier except in the uppermost for loop we're going to need to set that length variable. We're going to start nesting for loops because when we have one like let's say if we tried to use self get length and then we passed in this and then another parameter is and then another parameter a another parameter string. We're looping through each of these by using that items variable since items represents all of these. So we use our for loop to go through all of them. This is a string. So we have those four loops first off and then when we're inside each of those loops we're going to go through the character for each individual one. So we start with this and then we go through the character T, H, I and then S. So we do this individually each time that's why we're nesting these for loops. So now when we add that length character though we're going to have we're going to want to add at the end of it all lengths plus equals and then the form of our length variable. So now this should work if we when we get out of all of those four loops we can return all length all lengths. Remember to add that S on your variable and then it looks like that's all of it. Let's give it a go. Let's print out whatever we get returned by this a five. So we have four, two, one and six. Okay, this this has four letters in it is has two letters in it a has one letter in it and string has six letters in it. That works flawlessly awesome. But now we want to have support for that integer again so we're going to put in that same conditional statement that we had last time. But we're going to want to put it inside that for loop before we start testing the item. So let's do an if the type of the current item we're looking at. Remember there's no S here because we're looking at the individual one that we're looping through. If the type of item is an int, you want to change that to item equals the string form of item. So now we can get digits or at least the number of digits that are inside an integer or any other number. So let's try three right up here. One, two, one, six. Okay, so we've added support for integers. That's great. We've got the three there. That's one digit. We can change this one to how about, if I can select a thing, 228, 238, sorry, and we can run that one, two, three, six. How about we add a tuple in here, or another array or another list. We have one, two, two things in there, and then we have two elements inside that. So we're getting the length of each individual thing that we passed to it, and we're getting it returned back to us as a list, or as a tuple, or as an array. Whatever you want to think of it as, it's still each informational bit for each information that we send to that function. So yeah, you can keep playing with this idea, but remember you're going to be looping through each thing as much as you can to get all the information sapped out of it. So yeah, thanks for watching, guys. I know this one was a little bit more in-depth, but we're going to be looking at some really cool stuff lately, and getting more ourselves more acquainted with some of the built-in functions and some of the things that we're able to do with Python. So I'll see you guys in the next video. Bye.