This video is titled Tuples. One way in which we've already been using tuples in a lot of the coding we've been going through so far is as point value. Let's say if the values 3, 9, 0 in the x, y, z positions as a point, but something to remember about this is that just because I give it the variable name point doesn't mean it's holding point values. All this is doing is holding three values. It depends on how I want to use them that defines them as a point. Do I use this as a point somewhere later in the code? Do I understand these values as x, y, z? That's an important factor because actually, I could call it point, but this could be holding cat, dog, mouse strings. There's no functional relationship between me calling it point and the fact that it's holding three values. That's something to really keep in mind when you're using Tuples and variables in general. But assuming that these are point values, I could write a little code here that extracts the individual values from the tuple. I just write the variable name, followed by the index number in brackets, to select out or extract the value that's being held within that index slot. Again, as I explained in the lesson, that for both tuples and lists, the data held within them is indexically ordered from left to right, starting at zero and counting 1, 2, so forth. If I wanted to extract the data that's held within those slots, I would have to write it in this way. Point followed by zero and brackets, or one and brackets, or two and brackets. We can run this and see what it outputs and I'm getting an error. Let's just turn that off for now, which is fine. Let's run it again. So now I'm printing out, it's 3, 9, 0 and so it's extracting those values. Let's turn on this next section of the code here by Shift Control U. As I said in the lesson, tuples are immutable, not mutable, immutable. You can only change the values in a tuple by overwriting them and you have to overwrite the entire tuple to do this. Here I'm reassigning 0.3 new values, two of them just happened to be the same up here, but they could be different. 0.5, it doesn't matter, and then I'm going to print that out. Here it's printing out the initial values and then it prints out the tuple in its entirety. Tuple, sometimes I say tuple. It is tuple. The tuple in its entirety here. Now, if I wanted to try to change just one value in the tuple, so just to change this middle value, which is an index 1, we could try that, but it's going to throw an error. The error message is that the tuple object does not support item assignment, which is saying I can't just reassign one item in the tuple. I could do that if it was a list and so we'll see that next, but again, tuples, I can only change through overriding. Let's turn that back off. Shift Control C. Tuples can hold many values and data types. They're not just limited to numbers. They can also hold other tuples. We can nest tuples in tuples, we can also nest lists in tuples, and we can nest tuples in lists, and lists in lists, and we'll see that actually in the next lesson, because when we collect a list of points, what we're really collecting is a list of tuples or a lists of lists. Here, I've overwritten point with these new values and then I've printed it out down here. Let's go to this last part. Shift Control U and let's turn this off because that's going to throw an error. Shift Control C. Other instances in which we have already used tuples, add point, so that accepts a point. It needs three values, an x, y,, z in order to generate a point, render a point in the scene, add line, we've been using, that takes two arguments, both tuples. I'm hard-coding this one in and then feeding that, whatever the current is held in, point, which are these values. We're going to add a line and then saving that line in the variable line, and then scaling it and that's another instance that we've used tuple for scale values. We can run that. Let's run it again. That produces a line and created a point on the end of that line. Another instance in which we've already seen a tuple also was the curve area centroid, which we weren't feeding it a tuple, but it was returning a tuple. If you remember, if we go to our help menu and let's look up curve area centroid, and we see it returns a tuple, so the first element in the tuple is a point and the second one is a vector. We just want the point so the point is being held in index zero of that. Yeah. So that was covered in a previous lesson, we were using in lesson 1, this needs a closed shape, and because I put the zero on the end here after the function, it's only going to return the zero element from that to centroid, which is the point value. That's just a brief introduction to Tuples, how we use them and of course, we're going to be using them a lot throughout the remainder of the course, so it's good to know a bunch of stuff about them. Next, we're going to look at lists.