Hi, welcome to this new video. We're going to start learning about some variable types that are slightly more advanced. We've learned about integers, floats, strings, but what about having some collections? We're going to start introducing the notion of tuple in Python which is the first and most simple form of a collection. In Course 2, we're going to start spending a lot more time with lists and more complex data structures. As a matter of fact, Course 2 it's fully dedicated to data structures but it's important at this point that we start introducing ourselves to the notion of a collection with the tuple data structure. What is a tuple? In Python a tuple it's an order immutable collection of elements. Let's break that down. Immutable, specifically means that once you create a tuple, you cannot alter the content of the tuple meaning that you cannot add elements, you cannot remove elements from this collection. It's a fixed collection. Order means that the sequential order that they have it's important. You can expect to retrieve the information in the order in which they were created. The information inside that data structure is not going to be changed. Let's see examples of that in syntax. As a matter of fact, we've written a little bit of tuples, maybe not really discussing them so much, but whenever we use parentheses and commas within those parentheses, we're identifying a collection of data. In this case, the parentheses gives us the clarity to understand that it is in fact a tuple. Let's do an integer tuple. We can put several different integers but you can see that the tuple can also be done with different variable types such as the string. Once you've created a tuple, you might want to access a specific element within the tuple and this is done through accessing its index. The index represents which is the number or the location of the element within that data structure. In this case, the tuple has 4,5, and 7. If we use the square brackets, and notice here that we're using the square bracket to identify the index that we want to access and that would be number 4 and it's important that the first element in a tuple will be element 0. We need to remember that because that's the way tuples work. Element 0 would be the first one, element 1 would be the second one, and element 2 would be the third one. In this case, you can see that we can access each one of the elements within that tuple by using the according index. You're going to be hearing this a lot. What is the variable? Sometimes you use a variable that represents the index in order to access the information within a collection. Let's jump into processing and write a little bit of code using tuples and understand a few exceptions that might occur. Here we are back in processing. We have our template again. Let's start by creating a simple tuple. I'm going to call this variable countries and I'm going to use parentheses to specify something like USA, Canada, and Mexico. This is a tuple. We have identified three elements, three strings within the tuple and if we would print the result, let's evaluate what is in fact the tuple here we can see we get the full collection. All three elements are printed. But what if we would like to access the first element only USA? We could use the square brackets just after creating a bit of space here. You can see we can use the square brackets and put zero here to access the first element of the tuple. We get USA and we can do that for number 1 here and number 2 as well. You'll see how we can in fact obtain each one of those elements independently. There are some interesting ways in which we could iterate or access the information. For instance, let's imagine that we have a for loop. We can say for i and before we had been identifying how a for loop goes between a range between zero and 20, zero and 10 we go through numbers but when we have a collection such as tuple we can say for i in countries. I'm sorry, in countries. What we can get here, let's print i, so we're identifying that the variable i is each one of the elements within countries. If we print this, we would get a first line of USA, a second line of Canada, a third line of Mexico. This is a very easy way of using a tuple it would also be a case when we learn about lists, but in this case, how a collection is used as the source of the domain for an iterator. We're looping through the elements within the tuple. Let's also understand how this tuple is immutable. I will actually delete this for a moment but let's imagine that we want to add an element for some reason, or we want to alter some of the elements. Let's say countries and we say element 0. What if I thought, well, maybe I want to assign a new value and I would like to say Brazil, the first element of this tuple. I changed my mind I want it to be Brazil. Well, let's print our new tuple just to see the result of that operation. You'll see that we actually get nothing in the console here. We get in fact, a blank canvas because we're hitting an error. What is happening behind the scenes is that, well, because this data structure is immutable, it doesn't take changes. It was declared originally as USA, Canada, and Mexico. If we try to do operations of this type, we will run into a problem. These operations are allowed for a different kind of data structure that we would learn in course 2 which is a list. We're going to spend a lot of time in list because lists are very powerful. But as we understand tuples as our first more advanced data structure, we need to be aware that there's some restrictions on how we can use the data containing them. With that in mind, we're going to move to the next lesson.