Hello, in this video we are going to cover tuples. So tuples are sequence of Python objects. And they essentially know lifts, the difference between tuples and lists are tuples on my list, you know, can be changed, and the parentheses, you know, and lift to use square. So square brackets, that's really the main differences. So the syntax is slightly different and the competition so the next step after court is to put one final brackets or parentheses, and assign a sum MCs value One, two. Let's do a let's do B as Deuce Okay, so that's how you create a tuple.
So, accessing value for Bosch or you can say for the print, print the you know the entire to call if I want you to talk to tuple one, Apogee, Quinn tuple one, and to access it is just a bracket one that will get the second element because everything can be cycled pretty much everything starts at zero. So the first one will be zero and awkward, you know print now multiple set of values of between two square bracket as a property 00 to the four elements. And then let's run and see what we get. There we go all of it and then just the first few is the first four. So this is exclusive. So this is technically 012 and three, and obviously the second element as well.
So updating it. Like I said, you can't change it for this one before try and update it, not the normal way. So it's always good fun. Do people want to want to change the first one to divide? For example, if I run this, see what we get. As you can see, we are getting an error on line nine, which is this line, it is saying object to object and not support item assignment.
So it'll give you an error if you try and do that. So you don't want to be doing that you could obviously create a new tuple and form it with the foundations of a previous tuple of multiple two inputs. So you could get one to do an entire song and just get individual value that you know fine, but you can't just update an existing tuple. So, removing individual tuple elements is also not possible. So there is of course, nothing wrong with putting together nor tuple with the undesigned elements discarded so you could do that but if you try and you know, delete the video, and a face him trying to Tupac For example so if I delete it and if I try run this now that will work oh sorry to the one that will work for cheaper one afterwards that will work fine. But if I were to do a delay for one and the first one that they put in the valley but this one is a delete entire to plan you'll see what we get when we try and access it afterwards.
And there we go. So, so to avoid not be fine because we've deleted I can delete entire tuple just individually. Okay, so there's some really cool basic operations for tuples in Python, and the curfew them, I'm just going to cover one of them. Once you know the format that you should be, you're good to go up for the link in the description, they'll cover all the stuff, they extend in on what we've already going to cover in this video. So, one of them is land which is called the length of the actual tuple for how many elements there are. So when I do this print, land now to specify the tree for this access to cooperation tuples so if I run this, see oh yeah 1234 Okay, so we got a value of six because there is 123456 elements.
That said there's a whole heap of other operations from you know, being able to concatenate them to repetition, to indexing, slicing and matrix is all of that it will be in a link with this video. So feel free to check that out. And the built in order to call methods as well. So you can essentially converting list into a tuple you can get a max or min value from two port as well. But once you are familiar with what we've done in here, the rest of it will just feel easy. That's it for this video.
Thanks for watching, and I look forward to seeing you next time. To publish this video