 Welcome back everyone. This is Brian. Let's continue our journey into Python 3 with the tuple. Kind of a funny name, but this is really, really cool. So a tuple is a fast list that cannot be modified. It's read only. Once you create it, you can make zero changes to it. This thing exists solely to exchange data, and it's typically used between classes, between objects, between frameworks, and between devices. For example, let's say somebody made a package that was going to give you the CPU and RAM and hardware and all this cool information about your device. They don't want you to be able to modify that. So it may seem kind of plain and boring on the surface, but you can do some really cool tricks as we're about to see. First thing we're going to do is create a tuple. Go ahead and make a variable named T. And let's give this an assignment. Notice how it's got these little curved brackets here. When you see these curved brackets, think of it like a shield defending it because it's read only. You cannot change this. We're just going to give it some information. We don't really care what we put in there because we're just testing it out. Take print and T. You guessed it. It's got these curved brackets, and that is what denotes it's a tuple. The major takeaway here is the different style bracket denotes what it's going to be, whether it's a tuple, a set or a list or a dictionary, which we haven't covered yet. Now that we have a tuple, let's look at how to access the elements inside of that tuple. It's dead simple. We've done this before. Let's go ahead and say print F and we're going to access via the index. Give it our index position. But this is a zero based index. So zero is actually the first position and then one, two and so on and so on. Run works exactly the way you would expect it to. Let's go ahead and do a slice because slicing is pretty easy and fun. And we're going to grab this and say I want to go from two to the end of the couple there works as expected. And clear this out. Let's look at a bull operation. What we want to do now is we want to look for something specific inside of that tuple. I want to say is three and T. What this is going to do is tell Python, hey, take this value and inside of this tuple, and it could be a list or a set or a dictionary, we haven't covered dictionaries yet. And it's going to search and see if it's actually in there. Let's return a bull saying yes or no. In this case, true because three is right there. This is extremely easy to work with and it's blistering fast. Okay, bonus material. Let's talk about assignments. When I say assignment, what are we really talking about? I mean, tuples are kind of boring. You create them and you can access elements other than that you're done. Well, you can do some really cool things not just with tuples with lists and sets, but tuples make it really simple to understand. So we're going to make a tuple and we're going to put some variables. These are not values. These are variables. Remember a variable something that will change x comma y comma z. Now I'm going to make another tuple and we're going to give it values one, two, three. What are we doing here? What we're saying, take these variables and give them these values and Python under the hood is going to figure out which one needs to be which Go ahead and print x. Let's print y. And let's go ahead and print z. See this in action. One, two, three. Beautiful. Now let's talk about the range function. And this is something a lot of people don't really talk about too much. You just see it and you expect that it'll just magically work. Let's grab this. There we go. So we've got x, y, z and we're going to get rid of this right here. And we're going to say we want Python to do all that work. We don't want to say type out values all day long. So I'm going to say range. And let's give it a one, see what happens here. You're expecting an error. You got an error. Not enough values to unpack expected three got one. Well, let's just test this theory and say we want six, we're going to give it more than it needs. And of course, another error too many values to unpack expected three. So it's telling you I demand three. Where's it getting three? Right here under the hood, I thought is making a tuple of variables. And we can assign to those variables using the range function. Now range itself is not returning a tuple, we can test this out by just simply grabbing this and print this out, we're going to actually print range three. Notice how we got zero one two. So there is our range, but then we're printing range three and it's saying range zero to three. So what we're really expanding upon here is that the range itself is telling Python, go through a loop something we're going to talk about in a future video. But you have a start and an end. We haven't really given it a starting and we just said, hey, make three values. It's going to start at zero. Go three times. What if we don't want to start at zero, we want to start at one. Well, we give it a start. And now we have to give it an in position here. For why for because we need a starting position plus a length of how many we need to unpack which is four one plus three equals four. Now it just works exactly the way you think it would. I hope you enjoyed this video. You can find the source code out on github.com. If you need additional help, myself and thousands of other developers are hanging out in the void realms Facebook group. This is a large group with lots of developers and we talk about everything technology related not just the technology that you just watched. And if you want official training, I do develop courses out on udemy.com. This is official classroom style training. If you go out there and the course you're looking for is just simply not there. Drop me a note. I'm either working on it or I will actually develop it. I will put a link down below for all three of those and as always, help me help you smash that like and subscribe button. The more popular these videos become, the more I'll create and publish out on YouTube. Thank you for watching.