Hello guys.
Welcome back to another class of our course but the complete introduction to Python showing today's
class we are going to still talk about lists.
We talked about lists.
We talked about list list functions and everything.
And did they score this topic will be a bit in the same.
Well we are going to talk where we are still going to talk about lists but we are going to talk about
a little bit different type of lists.
And in this case it will be couples.
So to understand what is the difference between a normal list and a normal table and a table I will
simply write down a list right here.
So let's say we are creating a list of colors.
So in this case we'll write down let's say red
then write down yellow
and we'll write down.
All right.
So we have our tree colors and what we can do with this list.
Well we can run the app so you can see works works perfectly just print it to make you run.
So we print our list.
All right.
If we run it as you can see works perfectly we can do many things what we can for example if we want
to insert something we can insert so we can write down insert and let's say I want to insert something
at the segment the column so let's say I want to consider pink.
All right.
I run my app.
It will work perfectly.
But when I have it's awful what's the difference between a list and it's Apple is that I can play with
all the things that I have in my list but when I have a table for example I can modify it at all.
So let's say for example with a list I can insert I can insert new colors I can delete colors I can
what I can do I can do well I can do many things but with topples I just can't modify it I can't add
nothing I can delete nothing and I have to respect.
Well it's the it Apple.
It's simply a list that you can't modify.
You can put topples into lists but you can't modify topples by themselves.
So we just show you a quick example.
So right now this is our list.
So when we want to write it's up on how we write that topic at first I'll write it down the same way
as we write a list.
So when you write the list we write let's say for example write down colors so we'll click on equal
and we will use those parentheses right here for example we'll use the basic parentheses and we will
let's say write down our colors.
So once again we'll write down blue
yellow and red
and red.
All right.
So we have all our colors.
If we print if we run our app.
So once again we run our app which will run our colors so works perfectly we have our colors right here.
But let's say for example I want to add something.
So in this case I want to insert so I'll write down my insert function
I want to insert something at the second place 0 0 1 2 right here instead of red.
I want to add.
Let's say I want to add the black.
All right.
I run my app and look exactly what's going to happen.
So as you can see I have an error message and it's written right here topples object that has not achieved
youth in sir.
So you just can't modify it.
You can't use it.
You can't use no modifications in two couples.
And as I explained you can have a list of tables so let's say for example right here I have colors let's
say I'll Have Another.
Another couple of.
In this case shapes.
So I'll have for example square I have a triangle and I will have a circle.
All right.
So I have my shapes and I have my colors.
Now let's say I want to create a list of those couples.
So in this case I can write down let's say list and what I want to do is simply add colors
and shapes so my list will be will be constituted with colors and shapes.
And if I run it just print everything
presidency.
I have my couple that will have blue yellow red and my shapes as well.
So as you can see my list will have the couples that are that are here.
So I have a list of top.
So it's possible to create a list of top all but it's very important guys that you understand that the
main difference between couples and lists is simply that couples can be changed.
OK.
Right now in what exactly and what exact moment can you guys.
Well what exact moment can you guys guess when you can only use doubles but not a list.
So basically you want to use couples on things that you know will never ever ever change.
So let's say for example you want to you want to look for the address of someone.
So the address of this person will.
Well it can change but it will not necessarily change in the near future or something even let's say
easier.
You want to look for the coordinates of a place in the world let's say you want to look for the coordinates
of a mountain or at a certain county a country or a certain city.
Well you know that those coordinates will never change.
So you can store those and two tables so let's say we want to store one of those into couples.
So in this case we'll write down let's say for example a city let's let's say Paris.
So we have pirates Paris called coordinates.
So equal and let's say Write down the coordinates of Paris.
Once again let's say the coordinates of Paris will be 135 124.
Once again it's just an example.
And as you can see it's it will never it will never change.
Let's say you want to store the ad in the IP address of something we're out of a place.
Or just store the address IP of a certain device while you will store it in a temple because a IP address
will not change or you don't want it to change at least as a.
You don't want to change.
So you have things that you never want to change everything that you guys think will never change or
you don't want it to change.
You store it into a couple and everything that will change so it could be variables we can store those
into a list.
So this is the main difference.
So that's it for this class guys right now you understand.
You know another type of list which are couples and you'll see it's going to be very useful for our
by learning.
So that's it for this class guys.
And see all in our next class.